Skip to content

Instantly share code, notes, and snippets.

@mihow
mihow / load_dotenv.sh
Last active May 4, 2024 12:32
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@dovidweisz
dovidweisz / opacitator.scss
Last active March 22, 2024 10:45
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
@function opacitator($color){
$hi: 1;
$lo: 0;
$tol: 0.01;
$rgbs: (red($color) green($color) blue($color));
@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 6, 2024 08:48
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@jordan-brough
jordan-brough / git-recent
Last active April 8, 2024 02:53
Git: Display a list of recently checked out branches/tags/commits
#!/usr/bin/env bash
# Source: https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd
# See also: https://stackoverflow.com/a/25095062/58876
# Download this script as "git-recent" (no extension), chmod it to be executable and put it in your
# path somewhere (e.g. /usr/bin). You can then use it via `git recent` from inside any git repo.
# Examples:
@joechrysler
joechrysler / who_is_my_mummy.sh
Last active May 7, 2024 09:40
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@dctrwatson
dctrwatson / nginx.conf
Last active April 28, 2024 10:23
Caching NPM proxy using Nginx
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@mklabs
mklabs / childprocess-git-test.js
Created April 13, 2011 20:35
use spawn childprocess to perform a git commit
var spawn = require('child_process').spawn,
un = spawn('git', ['config', 'user.name', 'Batman']),
ue = spawn('git', ['config', 'user.email', 'batman@gotham.com']),
g = spawn('git', ['commit', '-am', "Jooooooker"]);
un.stdout.on('data', function (data) {
console.log('un stdout: ' + data);
});
ue.stdout.on('data', function (data) {