Instantly share code, notes, and snippets.

View clone-my-github-projects.sh
#!/bin/bash
#jsonProperty=clone_url
# or
jsonProperty=ssh_url
[[ -z $1 ]] && {
echo "Usage: $0 <GitHub User ID>"
exit 1
}
View yaml2json.py
# convert yaml to json
# pip3 install pyyaml
# http://pyyaml.org/wiki/PyYAMLDocumentation
# py3 yaml2json.py < ~/code/manpow/homeland/heartland/puphpet/config.yaml
# gist https://gist.github.com/noahcoad/51934724e0896184a2340217b383af73
import yaml, json, sys
sys.stdout.write(json.dumps(yaml.load(sys.stdin), sort_keys=True, indent=2))
View readstring_per_second.go
package main
import (
"bufio"
"fmt"
"os"
"time"
)
func main() {
View mailsender.c
/* gcc -static -o ~/mailsender mailsender.c
sudo dnf install glibc-static.i686
# 32 bit build
gcc -m32 -static -o mailsender mailsender.c
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <arpa/inet.h>
View git-branch-status
#!/bin/bash
# by http://github.com/jehiah
# this prints out some branch status (similar to the '... ahead' info you get from git status)
# example:
# $ git branch-status
# dns_check (ahead 1) | (behind 112) origin/master
# master (ahead 2) | (behind 0) origin/master
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \