Skip to content

Instantly share code, notes, and snippets.

View todgru's full-sized avatar

todgru

  • Portland, OR
View GitHub Profile
@todgru
todgru / starttmux.sh
Last active May 27, 2024 08:20
Start up tmux with custom windows, panes and applications running
#!/bin/sh
#
# Setup a work space called `work` with two windows
# first window has 3 panes.
# The first pane set at 65%, split horizontally, set to api root and running vim
# pane 2 is split at 25% and running redis-server
# pane 3 is set to api root and bash prompt.
# note: `api` aliased to `cd ~/path/to/work`
#
session="work"
@scaryguy
scaryguy / change_primary_key.md
Last active June 9, 2024 22:58
How to change PRIMARY KEY of an existing PostgreSQL table?
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of  your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;
@ilguzin
ilguzin / gist:6606011
Last active March 9, 2018 07:46
How to convert Java Key Store file to pem/key for nginx
1. Convert our ".jks" file to ".p12" (PKCS12 key store format):
keytool -importkeystore -srckeystore oldkeystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
1.1. List new keystore file contents:
keytool -deststoretype PKCS12 -keystore newkeystore.p12 -list
2. Extract pem (certificate) from ".p12" keysotre file:
@todgru
todgru / base58.rb
Created December 6, 2013 19:12 — forked from jou/base58.rb
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar
# 14 rue de Plaisance, 75014 Paris, France
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tlrobinson
tlrobinson / post-receive
Last active December 7, 2022 08:15
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f
@todgru
todgru / ad7c_vfo_i2c.ino
Created December 27, 2013 05:24
AD7C's AD9850 DDS and Arduino VFO. Modification for use with I2C LCD. (Note: ForceFreq is set to 1.) Requires FMalpartida's I2C lcd libraries: https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home I2C discovery and setup: http://forum.arduino.cc/index.php/topic,128635.0.html
/*
Main code by Richard Visokey AD7C - www.ad7c.com
Revision 2.0 - November 6th, 2013
Updated with LCD I2C by Todd Gruener K7KXI
*/
// Include the library code
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
@srt32
srt32 / gist:8535548
Created January 21, 2014 06:59
nginx.conf file for running multiple apps using passenger
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@todgru
todgru / ssh-tunnel.md
Last active May 6, 2023 15:32
How to set-up a SSH tunnel for AWS RDS

SSH Tunnel

Our db is hosted on Amazon. Our web server can connect to the db. Connections to the db are not allowed outside of the web server.

Run ssh tunnel locally:

This creates a tunnel from my local machine to the web server:

ssh -N -L 3307:my-rds-db.us-east-1.rds.amazonaws.com:3306 ec2-my-web-server.compute-1.amazonaws.com
@todgru
todgru / git-rebase-interactive.md
Last active December 18, 2023 02:30
git interactive rebase

#Git Interactive Rebase

Scenario: We have a topic branch we've been working on. We want to combine the last few commits into one single commit. Our intention is to merge this topic branch, with one clean commit, into our main dev branch.

Solution: Git Rebase Interactive

Checkout your topic branch and look at your commit history:

$ git checkout topic-branch
@todgru
todgru / aws-ec2-redis-cli.md
Created June 12, 2014 23:01
AWS redis-cli on EC2