Skip to content

Instantly share code, notes, and snippets.

View bwbaugh's full-sized avatar

Wesley Baugh bwbaugh

View GitHub Profile
@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.
@bwbaugh
bwbaugh / unifi-raspberry_pi-instructions.sh
Created August 20, 2016 22:38
Installing Ubiquiti UniFi Controller 5 on Raspberry Pi.
# Mirror of the instructions available here:
# http://www.lowefamily.com.au/2016/06/02/installing-ubiquiti-unifi-controller-5-on-raspberry-pi/
#
# These commands CANNOT be run in a script.
# They're just for reference.
# Install on Raspbian Jessie, or upgrade from Wheezy.
# Make sure all packages are upgraded (update && upgrade).
@bwbaugh
bwbaugh / user-data-stack.sh
Created March 15, 2016 06:31
EC2 user data script to install Haskell stack on Amazon Linux in order to build executables for AWS Lambda.
#!/bin/bash
yum update -y
curl -sSL https://s3.amazonaws.com/download.fpcomplete.com/centos/7/fpco.repo | tee /etc/yum.repos.d/fpco.repo
yum -y install stack
sudo -H -u ec2-user -- stack setup
# TODO(2016-04-14): Maybe download files and run `stack build`.
# NOTE: This script is mostly just for fun // a learning exercise. It's
# probably better to use something like Travis CI that can cache the
# ~/.stack/ directory to make build times reasonable. Though the
# whole point of this is to run on Amazon Linux for building static
@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 / 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 / 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 / logstash-guide.md
Last active November 26, 2020 13:12
Installing logstash server and client

Installing logstash

Server install

Install

Install the Java prerequisite:

@bwbaugh
bwbaugh / ubuntu-ec2-guide.md
Last active April 26, 2023 17:42
Guide to customize an Ubuntu EC2 instance.

Quick Start for Ubuntu EC2

Initial setup

Basic setup involves:

  • Install dotfiles.
  • Change the hostname.
@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 / dnsmasq.conf
Last active November 6, 2023 17:02
Changing the DNS server on a RT-AC66U / RT-N66U
# Add these, though they didn't seem to take effect for me.
server=8.8.8.8
server=8.8.4.4