Skip to content

Instantly share code, notes, and snippets.

Jesse Dearing jessedearing

Block or report user

Report or block jessedearing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 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 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
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
View one_password.sh
#!/usr/bin/env bash
set -e
# Eval so we can set the JSON values as shell variables
eval "$(jq -r '@sh "VAULT=\(.vault) UUID=\(.uuid)"')"
# Get the token or password from the first field of the second section (this is just how I store them, but you could use jq's select
password=`op get item --vault=$VAULT $UUID | jq -r '.details.sections[1].fields[0].v'`
View one_password.tf
data "external" "something_in_one_password" {
program = ["${path.cwd}/bin/one_password.sh"]
query = {
vault = "Personal"
uuid = "abc123"
}
}
View main_rds.tf
resource "aws_db_instance" "main" {
allocated_storage = 10
storage_type = "gp2"
engine = "mysql"
engine_version = "5.7"
instance_class = "db.t2.micro"
name = "main"
username = "root"
password = "${data.external.something_in_one_password.result.password}"
parameter_group_name = "default.mysql5.7"
View webtask_hack.js
const express = require('express')
const Webtask = require('webtask-tools')
const bodyParser = require('body-parser')
const MessagingResponse = require("twilio").twiml.MessagingResponse
const request = require('request-promise-native')
var app = express();
app.use(bodyParser.json());
You can’t perform that action at this time.