Skip to content

Instantly share code, notes, and snippets.

@cghiban
cghiban / mp4-to-dash.sh
Created October 4, 2021 13:49
mp4-to-dash.sh
#!/bin/bash
# can't remember where I found this..
#
# THIS SCRIPT CONVERTS EVERY MP4 (IN THE CURRENT FOLDER AND SUBFOLDER) TO A MULTI-BITRATE VIDEO IN MP4-DASH
# For each file "videoname.mp4" it creates a folder "dash_videoname" containing a dash manifest file "stream.mpd" and subfolders containing video segments.
# Explanation:
# Validation tool:
@cghiban
cghiban / mp4-to-gif.sh
Created October 4, 2021 13:42 — forked from Ultrabenosaurus/mp4-to-gif.sh
Simple bash script to convert MP4 videos to GIF
#!/bin/bash
#############################################
#
# mp4-to-gif
#
# Convert MP4 videos to GIF images
# Requires ffmpeg and imagemagick
#
# -g and --gifsicle options create a second optimised GIF for your consideration
@cghiban
cghiban / richhickey.md
Created September 4, 2021 00:15 — forked from prakhar1989/richhickey.md
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@cghiban
cghiban / get_ncbi_genbank_records.go
Last active July 26, 2021 20:19
retrieve ncbi data based on accession number in files
package main
import (
"bufio"
"fmt"
"io"
"log"
"net/http"
"net/url"
"os"
@cghiban
cghiban / make-load.sh
Created March 12, 2021 16:11 — forked from xaprb/make-load.sh
A little shell script for hammering the dvdstore database on Postgres
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: $0 <iterations>"
exit 1
fi
# Display product ID, category, title, price, num orders
# ordered by top products limit 10
function top_products(){
@cghiban
cghiban / create_triggers
Created March 12, 2021 15:39 — forked from colophonemes/create_triggers
Postgres TRIGGER to call NOTIFY with a JSON payload
CREATE TRIGGER person_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
'email',
'username'
);
CREATE TRIGGER income_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
@cghiban
cghiban / golang_job_queue.md
Created November 24, 2020 20:05 — forked from harlow/golang_job_queue.md
Job queues in Golang
@cghiban
cghiban / _tree
Created November 23, 2020 21:17 — forked from alexedwards/_tree
Dependency injection via closure (handlers in multiple packages)
.
├── go.mod
├── handlers
│ ├── books
│ │ └── books.go
│ └── env.go
├── main.go
└── models
└── models.go
@cghiban
cghiban / _tree
Created November 23, 2020 21:11 — forked from alexedwards/_tree
Config package with global variable
.
├── config
│ └── config.go
├── go.mod
├── go.sum
├── main.go
└── models
└── books
└── books.go
@cghiban
cghiban / home-server.md
Created October 26, 2020 18:59 — forked from nileshtrivedi/home-server.md
Home Server setup: Raspberry PI on Internet via reverse SSH tunnel

Raspberry Pi on Internet via reverse SSH tunnel

HackerNews discussed this with many alternative solutions: https://news.ycombinator.com/item?id=24893615

I already have my own domain name: mydomain.com. I wanted to be able to run some webapps on my Raspberry Pi 4B running perpetually at home in headless mode (just needs 5W power and wireless internet). I wanted to be able to access these apps from public Internet. Dynamic DNS wasn't an option because my ISP blocks all incoming traffic. ngrok would work but the free plan is too restrictive.

I bought a cheap 2GB RAM, 20GB disk VM + a 25GB volume on Hetzner for about 4 EUR/month. Hetzner gave me a static IP for it. I haven't purchased a floating IP yet.