Skip to content

Instantly share code, notes, and snippets.

🐙
some value

Brahm Lower bplower

View GitHub Profile
@bplower
bplower / Main.hs
Created Mar 21, 2018
Short circuiting a chain of operations in Haskell
View Main.hs
module Main where
import Control.Monad.Except
(ExceptT
, runExceptT
, throwError
)
import Control.Monad.IO.Class ( liftIO )
@bplower
bplower / rst_parse.py
Created Feb 15, 2017
Automatic TestCase creation for rst literal_block shell examples in python class docstrings
View rst_parse.py
import sys
import unittest
from docutils.core import publish_doctree
import subprocess
import opendir_dl
class ShellTestCase(unittest.TestCase):
def assert_shell_yields(self, command, expected_result):
result = subprocess.check_output(command, shell=True)[:-1]
if result != expected_result:
View recent_reddit_posts.py
#!/usr/bin/python
import urllib2
import json
last_timestamp_utc = 0
reddit_api = 'https://www.reddit.com/r/opendirectories/new.json?sort=new'
page_request = urllib2.urlopen(reddit_api)
page_content = json.loads(page_request.read())
posts = page_content['data']['children']
# API results are in order of newest to oldest, but we want to
View ThreadedHTTPServer.py
import threading
import SocketServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import httplib2
class QuietSimpleHTTPRequestHandler(SimpleHTTPRequestHandler):
"""Quiet http request handler
Subclasses SimpleHTTPRequestHandler in order to overwrite the log_message
method, letting us reduce output generated by the handler. Only standard
messages are overwritten, so errors will still be displayed.
@bplower
bplower / dynamic_property_test.py
Last active Sep 18, 2016
Dynamic property assignment with default custom get and set methods
View dynamic_property_test.py
#!/usr/bin/python
# This example implementation is *extremely* similar to what is being asked and
# answered on the following stack overflow page:
# http://stackoverflow.com/questions/1325673/how-to-add-property-to-a-python-class-dynamically
# Simply running this script will return the following output, which follows
# a story told through inline comments.
# user@debian:~$ ./dynamic_property_test.py
@bplower
bplower / phpVirtualBox Debian 8 Install Script
Last active Nov 8, 2017
This is a script to install VirtualBox and phpVirtualBox on a headless Debian 8 machine.
View phpVirtualBox Debian 8 Install Script
#!/bin/bash
# Author: Brahm Lower
# Name: phpVirtualBox Debian 8 Install Script
# Source: https://gist.github.com/bplower/b7e193fc3861e964c367/
# Prerequisite Packages:
# bash, openssl, cat, grep, echo, wget, apt-key, apt-get, useradd, usermod, passwd, mv, cp, sed, systemctl
# Installed Packages:
# build-essential, dkms, unzip, apache2, php5, php5-mysql, libapache2-mod-php5, php-soap, virtualbox-5.0
# Description:
# This is a script to install VirtualBox and php VirtualBox on a headless Debian 8 machine.
@bplower
bplower / koel-installation-docs_debian8.md
Last active Dec 2, 2018
This is installation documentation for installing Koel on Debian 8.
View koel-installation-docs_debian8.md

Installation on Debian 8

This is installation documentation for installing Koel on Debian 8.

Install Dependancies

Most packages can be installed via apt-get.

user@debian:~/$ sudo apt-get install -y apache2 mysql-server php5 php5-mysql g++ git curl

Composer

View keybase.md

Keybase proof

I hereby claim:

  • I am bplower on github.
  • I am bplower (https://keybase.io/bplower) on keybase.
  • I have a public key whose fingerprint is 9397 76F4 F064 4FD2 955D 0511 1ECD 50E2 4027 9A7E

To claim this, I am signing this object:

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.