Skip to content

Instantly share code, notes, and snippets.

View bwbaugh's full-sized avatar

Wesley Baugh bwbaugh

View GitHub Profile
@bwbaugh
bwbaugh / classify.py
Created April 25, 2013 21:03
Detecting a Specific Watermark in a Photo with Python Get example training and testing images here: <http://bwbaugh.com/stack-overflow/16222178_watermark.tar> Stack Overflow question: <http://stackoverflow.com/questions/16222178/detecting-a-specific-watermark-in-a-photo-with-python-without-scipy>
# Copyright (C) 2013 Wesley Baugh
"""Tools for text classification.
Extracted from the [infer](https://github.com/bwbaugh/infer) library.
"""
from __future__ import division
import math
from collections import defaultdict, namedtuple, Counter
from fractions import Fraction
@bwbaugh
bwbaugh / server-setup-guide.md
Last active November 26, 2023 07:44
Guide to set up a new VPS

Guide to set up a new VPS

This guide was written while setting up an Unbuntu VPS. There may be some differences when setting up a different distro.

Initial steps as root

Do some basic setup as the root user, which should mainly consist of

@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
@bwbaugh
bwbaugh / server-name-wordlist-mnemonic.txt
Last active May 18, 2023 11:09
Server name wordlist (mnemonic)
# Original blog post: <https://mnx.io/blog/a-proper-server-naming-scheme/>
# Original word list: <http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt>
# Sample usage: `curl <gist> | tail --lines +4 | shuf | head --lines 1`
acrobat
africa
alaska
albert
albino
album
alcohol
@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 / example-output.md
Last active December 7, 2022 12:18
Generate a randomly connected graph with N nodes and E edges.

Example output

Minimum number of edges

python random_connected_graph.py -p -g names.gml names.txt

Console

@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 / 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 / word_ similarity.py
Last active June 4, 2020 19:52
Determine if two (already lemmatized) words are similar or not.
def sim(word1, word2, lch_threshold=2.15, verbose=False):
"""Determine if two (already lemmatized) words are similar or not.
Call with verbose=True to print the WordNet senses from each word
that are considered similar.
The documentation for the NLTK WordNet Interface is available here:
http://nltk.googlecode.com/svn/trunk/doc/howto/wordnet.html
"""
from nltk.corpus import wordnet as wn
@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).