Skip to content

Instantly share code, notes, and snippets.

@drautb
drautb / server.py
Created August 28, 2019 13:35 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@drautb
drautb / sweetpea-window-examples.py
Last active February 5, 2019 02:18
SweetPea Window Examples
# SweetPea Window Examples
# Derived Levels are defined by three things:
# - A Derivation Function
# - An Argument List
# - A Window
#
# Windows in turn are defined by a width and a stride. WithinTrial and
# Transition are just shorthand for Windows with widths of 1 and 2
# respectively, and both with a stride of 1.
@drautb
drautb / Preferences.sublime-settings
Created October 2, 2015 16:03
SublimeText 3 Settings
{
"additional_path_items":
[
"/usr/local/heroku/bin",
"/Users/drautb/.rvm/gems/ruby-1.9.3-p547/bin",
"/Users/drautb/.rvm/gems/ruby-1.9.3-p547@global/bin",
"Users/drautb/.rvm/rubies/ruby-1.9.3-p547/bin",
"/Users/drautb/.nvm/v0.10.31/bin",
"/usr/local/sbin",
"/usr/local/bin",
@drautb
drautb / xmonad.hs
Created March 7, 2015 05:38
XMonad config
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
myManageHook = composeAll
[ className =? "Gimp" --> doFloat
, className =? "Vncviewer" --> doFloat
@drautb
drautb / arch-maintenance.sh
Last active August 29, 2015 14:16
Runs recommended maintenance tasks on an Arch installation.
#!/usr/bin/env sh
# Runs the procedures recommended on this page:
# https://wiki.archlinux.org/index.php/System_maintenance
SYSTEMCTL=/usr/bin/systemctl
JOURNALCTL=/usr/bin/journalctl
PACMAN=/usr/bin/pacman
echo "\n*** FAILED SERVICES ***\n"
@drautb
drautb / deploy-frog-to-gh-pages.sh
Last active August 29, 2015 14:12
Deploys a Frog site to GitHub pages.
#!/usr/bin/env sh
# This script deploys a Frog site to GitHub pages.
# It should be run from the directory containing
# the .frogrc file.
#
# It will determine the output directory from the
# .frogrc file, and push it to the gh-pages branch.
set -ux
# Author: Ben Draut, 2014
#
# Options file for Artistic Style code formatter.
# Follows guidelines given in "The Elements of Java Style".
#
# Artistic Style: http://astyle.sourceforge.net/
# Book: http://mmc.geofisica.unam.mx/utils/CyC++/Documentacion/CyC++Style/JavaStyle/The%20Elements%20of%20Java%20Style.pdf
# Options documentation: http://astyle.sourceforge.net/astyle.html#_Options_File
# Attached bracket style, Pg. 10
@drautb
drautb / template.sublime-project
Last active August 29, 2015 14:03
A Sublime Text project template for Maven projects.
{
"folders":
[
{
"follow_symlinks": true,
"path": "~/FamilySearch/project-dir",
"file_exclude_patterns": ["*.iml"],
"folder_exclude_patterns": ["target", ".idea", "target" ]
}
],
@drautb
drautb / AWSSDKStressTest.java
Created June 27, 2014 17:15
Sandbox to stress AWS SDK. The SDK will automatically retry requests if your hitting the API too frequently, but only 3 times by default. This sometimes is insufficient.
import java.util.Date;
import java.util.Map;
import java.lang.Thread;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.cloudformation.AmazonCloudFormation;
import com.amazonaws.services.cloudformation.AmazonCloudFormationClient;
@drautb
drautb / patch-examples.sh
Created June 6, 2014 16:51
Patching with Git
# Create a patch for a single commit
git format-patch -1 HEAD
# Or
git format-patch -1 <sha>
# Applying the patch
git apply --stat file.patch # show stats.
git apply --check file.patch # check for error before applying.
git am < file.patch # apply the patch finally.