Skip to content

Instantly share code, notes, and snippets.

View peterkappus's full-sized avatar

Peter Kappus peterkappus

View GitHub Profile
@peterkappus
peterkappus / run.sh
Last active May 23, 2018 16:37
Docker file mount demo.
#create a local html file
echo "<html><h1>Yo</h1></html>" > index.html
#start nginx inside a container
docker run -p 80:80 -v "$(PWD)":/usr/share/nginx/html:ro -d nginx &
#fire up a browser and point it at local host
open http://localhost
#get the container ID to kill it later...
@peterkappus
peterkappus / rails_docker_starter.sh
Last active August 6, 2019 15:56
New Docker, Rails, Postgres app in one bash script
#This script will create the required Dockerfile, docker-compose.yml, Gemfile, etc. and create a new rails app (using postgres)
#BEWARE! It will overwrite any existing files in the folder including Dockerfile, docker-compose.yml, and README.md
#the databses will be called "myapp_development", and "myapp_test"
cat << EOF > Dockerfile
FROM ruby:latest
#USER $USER
#make sure we don't get tripped up by any inherited proxies
#RUN unset HTTP_PROXY
#RUN unset HTTPS_PROXY
@peterkappus
peterkappus / docker_demo.sh
Last active January 5, 2019 10:20
Use docker to host a local html file with nginx!
# What is it? Use docker to host an html file using nginx!
# Pre-requisites: You've installed docker and logged into docker-hub
#make our html file
echo "<h1>Hello world</h1>" > index.html
#start docker and mount our current working directory into nginx
docker run -p 80:80 -v "$(PWD)":/usr/share/nginx/html:ro -d nginx
#go have a look!
@peterkappus
peterkappus / github.gs
Last active October 3, 2018 17:09
Get open github pull requests in Google Sheets - Google Script
//generic function to get JSON from a github API endpoint
function getJSON(url) {
// Your github username
username = "<USERNAME>"
// Your access token (see https://github.com/settings/tokens)
password = "<ACCESS_TOKEN>"
//basic auth using access token
var options = {};
options.headers = {"Authorization": "Basic " + Utilities.base64Encode(username + ":" + password)};
@peterkappus
peterkappus / .gitconfig
Last active July 23, 2022 17:29 — forked from betandr/gist:fe945e5837513cbf7c011a341417cb32
Handy git aliases from betandr.
[http]
proxy = http://some-proxy:80
[https]
proxy = http://some-proxy:80
[alias]
#co = checkout
#br = branch
ci = commit
st = status
co = !git checkout
@peterkappus
peterkappus / README.md
Last active January 6, 2019 23:20
HAProxy on CentOS

Installing a load balancer on CentOS

...cuz we use CentOS on the work VMs :(

Create some docker images to use as upstream hosts:

mkdir s2 s1
echo "Hello World." > s1/index.html
echo "Good evening, Pasadena." > s2/index.html
@peterkappus
peterkappus / github_prs.gs
Created February 4, 2019 11:56
Create a Dashboard in Google Sheets showing open pull request counts from Github
//use this to get current counts of Pull Requests to put into a dashboard.
// Things to update: YOUR_USER_NAME, YOUR_ACCESS_TOKEN, YOUR_REPO_PATH (see below)
// add custom menu
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Custom GitHub Menu')
.addItem('Get User Repos','getUserRepos')
.addItem('Get rate quota','getGitHubRateLimit')
.addToUi();
@peterkappus
peterkappus / step_defs.rb
Created March 9, 2019 11:26
Some basic BDD step definitions in Capybara (Ruby)
#This file contains some useful steps for interacting with specific page elements, moving forwards and backwards in time, etc. They're pretty low-level so you might use them to get started but eventually you'll want to write your own application-specific steps.
#things to do before each scenario
Before do |scenario|
end
#and after....
After do |scenario|
end
@peterkappus
peterkappus / drawbar_organ.scd
Last active December 30, 2019 01:34
Super Collider treasures
(
Server.default.options.device = "BlackHole 16ch";
//Server.default.options.device = "Built-in Output";
//ServerOptions.devices;
//handle large delay sizes
//s.options.memSize= 8192*2;
//s.reboot;
@peterkappus
peterkappus / rec.bash
Last active March 14, 2020 11:13
Bash script for recording audio with Sox on my mac
#!/bin/bash
# For recording flac & mp3 files (with compression and silence trimming)
# Prerequisite: sox
#`brew install sox --with-lame --with-flac --with-libvorbis`
# For recording flac & mp3 files.
# Grab your laptop
# Plug in your USB sound device