Skip to content

Instantly share code, notes, and snippets.

View dantheman213's full-sized avatar
๐Ÿš€

Dan dantheman213

๐Ÿš€
View GitHub Profile
@dantheman213
dantheman213 / update_nodejs_npm_linux.sh
Created August 9, 2020 18:13
update_nodejs_npm_linux.sh
Update nodejs to latest version:
sudo npm install -g n
sudo n latest
Update npm to latest version:
sudo npm install -g npm
Do what @runcible suggested
hash -d npm
@dantheman213
dantheman213 / exponential_backoff.go
Last active December 10, 2022 16:10
Golang exponential back off simple example
package main
import "fmt"
import "time"
import "math"
var exponentialBackoffCeilingSecs int64 = 14400 // 4 hours
func main() {
fmt.Println("Hello World")
@dantheman213
dantheman213 / average-geolocation.js
Created August 23, 2020 19:16 — forked from tlhunter/average-geolocation.js
Calculate the center/average of multiple GeoLocation coordinates
/**
* Calculate the center/average of multiple GeoLocation coordinates
* Expects an array of objects with .latitude and .longitude properties
*
* @url http://stackoverflow.com/a/14231286/538646
*/
function averageGeolocation(coords) {
if (coords.length === 1) {
return coords[0];
}
@dantheman213
dantheman213 / pdf.md
Created March 21, 2021 19:00
Convert PDF into high quality images
@dantheman213
dantheman213 / elementary_os_install_nvidia.sh
Created June 19, 2021 17:21
Elementary OS Install NVIDIA Graphics Card
# Elementary OS install nvidia graphics drivers
## remove old drivers
sudo apt autoremove nvidia*
## install new drivers
sudo ubuntu-drivers autoinstall
#!/usr/bin/env bash
# ex: ./charles_convert_raw_hexdump_to_bin.sh hexdumpraw.txt hexformatted.txt data.bin
# hexdumpraw.txt ex:
## 00000510 0a 6d 6f 64 65 6c 5f 6e 61 6d 65 12 07 4e 65 78 model_name Nex
## 00000520 75 73 20 35 1a 20 0a 11 61 72 63 68 69 74 65 63 us 5 architec
## 00000530 74 75 72 65 5f 6e 61 6d 65 12 0b 61 72 6d 65 61 ture_name armea
## 00000540 62 69 2d 76 37 61 1a 19 0a 0b 64 65 76 69 63 65 bi-v7a device
## 00000550 5f 6e 61 6d 65 12 0a 68 61 6d 6d 65 72 68 65 61 _name hammerhea
@dantheman213
dantheman213 / timeDiff.go
Created August 3, 2022 20:26
Golang get time diff from a, b, formatted pretty
// e.g. returns 00:00:25
func getTimeDiff(a, b time.Time) string {
d := b.Sub(a)
hour := int(d.Seconds() / 3600)
minute := int(d.Seconds() / 60) % 60
second := int(d.Seconds()) % 60
return fmt.Sprintf("%02d:%02d:%02d", hour, minute, second)
}
@dantheman213
dantheman213 / word-scramble.pl
Created September 28, 2022 20:40
word scramble solver
#!/usr/bin/perl
use strict;
use warnings;
#
# Complete the 'SearchForWord' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts following parameters:
@dantheman213
dantheman213 / Tomb Raider 1.cfg
Created September 29, 2022 02:02
Tomb Raider (1996) PC JoyToKey Xbox One controller config
[General]
FileVersion=69
NumberOfJoysticks=2
NumberOfButtons=32
DisplayMode=2
UseDiagonalInput=0
UseDiagonalInput2=0
UsePOV8Way=0
RepeatSameKeyInSequence=0
Threshold=20