Skip to content

Instantly share code, notes, and snippets.

@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
@dantheman213
dantheman213 / pdf.md
Created March 21, 2021 19:00
Convert PDF into high quality images
@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 / 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 / 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
echo "username ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
@dantheman213
dantheman213 / ffmpeg.md
Last active April 23, 2024 18:10
ffmpeg cheatsheet

ffmpeg cheatsheet

Extract video at 30 seconds in and the duration with be 5 seconds

ffmpeg -ss 00:00:30 -i orginalfile -t 00:00:05 -vcodec copy -acodec copy newfile

Add a watermark logo to the bottom right of the video offset by 30 x 30 from corner

@dantheman213
dantheman213 / bst.go
Created April 21, 2020 20:40
Golang binary tree
package main
import "fmt"
type Node struct {
Left, Right *Node
Value int64
}
type BinarySearchTree struct {
@dantheman213
dantheman213 / video_detect_commercial_break.sh
Created April 21, 2020 00:36
Detect all the commercial breaks points in a given TV show video file
ffmpeg -i "file.mp4" -vf "blackdetect=d=1:pix_th=0.00" -an -f null - 2>&1 | grep blackdetect
@dantheman213
dantheman213 / generate_iso_from_files.sh
Created April 16, 2020 00:22
Generate an ISO using a docker container
INPUT_FILES_WITHIN_DIR=/home \
OUTPUT_DIR=/mnt/c/Users/danie/Desktop/output \
OUTPUT_FILE_NAME=file.iso \
ISO_LABEL=LABEL \
docker run --rm -w /iso -v $INPUT_FILES_WITHIN_DIR:/iso -v $OUTPUT_DIR:/output genisoimage -v -J -V $ISO_LABEL -o /output/$OUTPUT_FILE_NAME .