Skip to content

Instantly share code, notes, and snippets.

Avatar

Jesse Dearing jessedearing

View GitHub Profile
@jessedearing
jessedearing / cleanup.sh
Created Apr 12, 2012 — forked from mdp/cleanup.sh
Git branch cleanup
View cleanup.sh
#!/bin/bash
# This must be run from master
git checkout master
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
git branch --merged master | grep -v 'master$' | xargs git branch -d
# Show remote fully merged branches
@jessedearing
jessedearing / gist:2351836
Created Apr 10, 2012 — forked from twoism-dev/gist:1183437
Create self-signed SSL certificate for Nginx
View gist:2351836
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
View fixup-certs.py
#!/usr/bin/env python3
import base64
import json
from kubernetes import config, client, dynamic
from cryptography import x509
from cryptography.hazmat.backends import default_backend
config.load_kube_config()
dc = dynamic.DynamicClient(client=client.ApiClient())
View vim cheatsheet.md

#Vim Cheat Sheet

  • gqip - Reformats paragraph to textwidth
  • gq - Reformats selection
  • :Tab /= - Equally spaces based on the = symbol (requires Tabular vim plugin)
  • :setf language - Changes current language
  • :set language=language - Changes current language
  • <C-a> - Increments the number under the cursor
  • <C-x> - Decrements the number under the cursor
  • ~ - Toggles case and moves to next character in normal mode
@jessedearing
jessedearing / profile.go
Created Jan 5, 2017
Have go dump a stack trace on USR1
View profile.go
package main
import (
"os"
"os/signal"
"runtime/pprof"
"syscall"
)
func main() {
View check_expiration.py
#!/usr/bin/env python3
import base64
import argparse
from datetime import datetime, timedelta
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from kubernetes import client, config
config.load_kube_config()
View meme.js
var querystring = require('querystring');
var http = require('http');
var util = require('util');
exports.process = function(message, sayCallback) {
if(message.indexOf('generate meme') !== -1) {
var params = message.split(' ');
if(exports.types[params[2]]) {
var linesRegex = new RegExp(params[2] + " (.*) / (.*)");
var lines = linesRegex.exec(message);
@jessedearing
jessedearing / 0-README.md
Last active Nov 13, 2019
@sadserver's tweets in fortune file format
View 0-README.md

Description

This is all of @sadserver's tweets packaged in a file ready to be converted into a .dat file for the fortune program.

Installing

  1. Install fortune if your distro doesn't already have it.
  2. Convert this into a fortune file run strfile -c % sadserver_tweets sadserver_tweets.dat
  3. Copy the files into your fortune directory cp sadserver_tweets sadserver_tweets.dat /usr/local/share/games/fortunes. Note that I'm on OS X so the file path reflects that. Linux is going to be something like /usr/share/games/fortunes.
  4. Add a line to your shell's profile/rc file. I.e. fortune sadserver_tweets
  5. Laugh/cry when you log into your desktop/servers.
@jessedearing
jessedearing / g.go
Last active Oct 3, 2019
Simple go program to record timings for git pulls, pushes, and fetches
View g.go
package main
import (
"fmt"
"os"
"os/exec"
"strconv"
"strings"
"time"
)
View etcdvars.sh
export ETCDCTL_API=3 ETCDCTL_CACERT=$ETCD_TRUSTED_CA_FILE ETCDCTL_CERT=$ETCD_CERT_FILE ETCDCTL_KEY=$ETCD_KEY_FILE ETCDCTL_DISCOVERY_SRV=$ETCD_DISCOVERY_SRV