Problem: Paying per user is getting expensive for a service that just hosts some static files. It’s not 2010 anymore so who wants to deal with nginx configs? Well luckily for you there’s a couple great solutions Cloudflare Pages Essentially a 1 for 1 replacement for Netlify and Vercel, plus it has a great free tier and then goes up to $20/month for more concurrent builds. It has build previews […]
Leetcode 1920. Build Array from Permutation in Golang
https://leetcode.com/problems/build-array-from-permutation/ 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 […]
Fixing “change_email script does not exist” on Auth0
If you’re seeing that error then you probably have a custom DB connection on Auth0, and the problem is that Auth0 could change the email for the user, but they don’t know how to change it on your database. The solution is to write a script showing Auth0 how to do it, similar to the login, create, verify scripts you have on the Database -> Custom Database page. Since this […]
Setting up Docker on your Computer
For Windows and Mac OS X there’s an easy new application called Docker Desktop that will contain everything you need, download it here. For Linux, just follow the guides here. If you want a GUI on Linux, and I would highly recommend it, install Portainer by running the following commands after installing docker: $ docker volume create portainer_data$ docker run -d -p 8000:8000 -p 9000:9000 –name=portainer –restart=always -v /var/run/docker.sock:/var/run/docker.sock -v […]
No module named dbus
A rather annoying error that I recently encountered where dbus wasn’t installed correctly. My setup was python 3 on debian stretch and the following commands didn’t fix it: sudo apt install python-dbusorsudo apt install python3-dbus Then I tried pip install dbus-python and got a build time error, the output showed: checking for DBUS… noconfigure: error: Package requirements (dbus-1 >= 1.8) were not met: and the final solution was to run […]
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, […]