Skip to content

Instantly share code, notes, and snippets.

#!/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 | \
@mclarkson
mclarkson / mailsender.c
Created January 31, 2017 15:15
The mailsender binary used in nagrestconf
/* 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>
@mclarkson
mclarkson / readstring_per_second.go
Created March 7, 2017 13:44
Output text received on input in 1 second chunks
package main
import (
"bufio"
"fmt"
"os"
"time"
)
func main() {
@mclarkson
mclarkson / clone-my-github-projects.sh
Created October 16, 2017 10:38
Clone all of a user's GitHub projects
#!/bin/bash
#jsonProperty=clone_url
# or
jsonProperty=ssh_url
[[ -z $1 ]] && {
echo "Usage: $0 <GitHub User ID>"
exit 1
}
@mclarkson
mclarkson / yaml2json.py
Created May 15, 2017 09:23 — forked from noahcoad/yaml2json.py
Python to Convert yaml to json
# 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))
@mclarkson
mclarkson / .screenrc
Created September 23, 2020 10:48
GNU Screen screenrc
shell /usr/bin/zsh
defscrollback 10000
term xterm-256color
startup_message off
hardstatus on
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
vbell on
windows
bind j focus down
bind k focus up
@mclarkson
mclarkson / .tmux.conf
Last active November 8, 2020 14:24
tmux config that looks similar to the default gnu screen
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
#set-option -g status-style bg=colour235,fg=colour136,default # bg=base02, fg=yellow
# zsh as default shell
set-option -g default-shell /bin/zsh
# set window split
bind-key v split-window -h
bind-key b split-window