Your Cart

Leetcode 1920. Build Array from Permutation in Golang We need to loop through the nums array and fill in a new array in the proper order. func buildArray(nums []int) []int { // Create a new array of the same size as nums ans := make([]int, len(nums)) // Loop through nums for index, _ := range nums { // Fill in the new array with the proper value from nums, // taken from the question ans[index] = nums[nums[index]] […]

Simple Input Form in React

Here’s how to create a basic form that takes in some user input and sends it off to a backend server. I’ve kept the sample up to date for React’s best practices in 2021, along with some comments to help you customize it for your needs. import React, { useState, useEffect } from “react”;import * as ReactDOM from ‘react-dom’const axios = require(‘axios’);const App = () => { // One state […]

15 minute recap of a Defcon Talk on Containers

The talk is  “An Attacker Looks at Docker: Approaching Multi-Container Applications“ by Wesley McGrew and can be found here. My presentation at TASK Google Slides – create and edit presentations online, for free. Create a new presentation and edit with others at the same time. Get stuff done with or without an internet connection. Use Slides to edit PowerPoint files. Free from Google. create and edit presentations online, for free. […]

Resetting Root MySQL password for MariaDB on CentOS

You’ve lost the root password for your MariaDB database – now what do  you do? You can’t recover your existing password, but you can get into  your database to create a new root password. You just need root  privileges on the Linux server that is running MariaDB. Stop the  database using the systemctl command: `systemctl stop mariadb.service`   Now we’re going to start up the SQL server but with the […]

How to calculate an Excel BETA.INV in Python

Recently I was tasked with coding a complex calculation in Python, where the source was in Excel. They used the BETA.INV function to find theinverse of the beta cumulative probability density function. Luckily, SciPi also has a beta function where the .PPF is the inverse of .CDF. The first three arguments, probability, alpha and beta are the same, but the in excel you can set the lower and upper bound, […]