Skip to content

Instantly share code, notes, and snippets.

View bwbaugh's full-sized avatar

Wesley Baugh bwbaugh

View GitHub Profile
@bwbaugh
bwbaugh / nginx.conf
Last active August 29, 2015 14:16 — forked from oroce/nginx.conf
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
@bwbaugh
bwbaugh / tor-install-guide.md
Created April 19, 2015 22:50
Install guide for Tor and Polipo.
class InterruptableRegion(object):
def __init__(self, signum_list=None):
if signum_list is None:
signum_list = [signal.SIGINT]
self.signum_list = signum_list
self.reset()
def __enter__(self):
self.reset()
@bwbaugh
bwbaugh / wunderlist_extract_titles.sh
Created June 2, 2015 23:39
Extract all of the task titles from a specific Wunderlist list.
<wunderlist-2015062-17-18-11.json jq '.data.tasks | .[] | select(.list_id == 143399535) | select(.completed == false) | .title' --raw-output
@bwbaugh
bwbaugh / raspberrypi-guide.md
Last active August 29, 2015 14:25
Setting up a raspberry pi.

Quick Start for Raspberry Pi

Initial setup

Basic setup involves:

  • Install dotfiles.
  • Change the hostname.
@bwbaugh
bwbaugh / sumfibparity.hs
Last active November 12, 2015 23:57
Visualize the parity of the sum of digits from numbers of the Fibonacci sequence. https://oeis.org/A004090
import Data.Char (digitToInt)
import System.IO
main :: IO ()
main = do
hSetBuffering stdout NoBuffering
putStrLn $ concatMap toFancy $ sumOfDigits fib
toFancy :: Integer -> String
toFancy x
@bwbaugh
bwbaugh / twitter-names.py
Last active December 17, 2015 05:29
Generating possible Twitter usernames of a certain length (in this case, 3). For @_milesokeefe
lower = [chr(x) for x in range(ord('a'), ord('z') + 1)]
# >>> lower
# ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
# 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
digits = [str(x) for x in range(10)]
# >>> digits
# ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
characters = lower + digits + ['_']
@bwbaugh
bwbaugh / twitter-available-usernames.py
Last active December 17, 2015 05:29
Find unknown, suspended, or deleted screen names of a certain length. For @_milesokeefe.
from __future__ import division
import itertools
import json
import tweepy
# Configuration.
USERNAME_LENGTH = 3
SAVE_FNAME = 'twitter_usernames.txt'
@bwbaugh
bwbaugh / expressions_equal_target.hs
Last active January 24, 2016 23:09
Find expressions that match target value
{-
The origin of this puzzle if from #codingame chat. Ideas for the high
level approach come from TheNinja.
Write a program that outputs all possibilities to put + or - or nothing
between the numbers 1,2,...,9 (in this order) such that the result is
equal to stdin. For an example: 1 + 2 + 3 - 4 + 5 + 6 + 78 + 9 = 100.
Usage:
@bwbaugh
bwbaugh / ec2-ubuntu-16.04-swap.md
Last active September 27, 2019 06:27
EC2 swap file instructions. Gathered from several online articles / blogs / stackexchange.

Can check if you're using swap with sudo swapon --show and free -h.

EBS volume

Useful for t2.micro and other instances with no access to instance store. Use this if you prefer not to mess with the root volume.

  1. Create the EBS volume e.g., 1 GB.