Skip to content

Instantly share code, notes, and snippets.

Avatar
📎
"It looks like you're writing a distributed web app!"

Brendan Smithyman bsmithyman

📎
"It looks like you're writing a distributed web app!"
View GitHub Profile
@bsmithyman
bsmithyman / keybase.md
Created May 7, 2017
Verification post for Keybase
View keybase.md

Keybase proof

I hereby claim:

  • I am bsmithyman on github.
  • I am bsmithyman (https://keybase.io/bsmithyman) on keybase.
  • I have a public key ASBOa1GAD4sXYNqt3C8cl8KaXBx0A4erRUGsaYDCE_3j0Ao

To claim this, I am signing this object:

@bsmithyman
bsmithyman / resumable.py
Created Oct 5, 2016
Generate a resumable upload URL for Google Cloud Storage
View resumable.py
import json
import os
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
GCP_CREDENTIALS_FILE = os.getenv('GCP_CREDENTIALS_FILE', 'client-secret.json')
GCS_UPLOAD_URL_PATTERN = 'https://www.googleapis.com/upload/storage'+ \
'/v1/b/{bucket}/o?uploadType=resumable'
def get_upload_url(bucket, filename, content_length, content_type='application/octet-stream'):
@bsmithyman
bsmithyman / graph_stack.py
Last active May 4, 2016
Generate a call graph for the enclosed context
View graph_stack.py
import contextlib
import os.path
from pycallgraph import PyCallGraph
from pycallgraph.output import GraphvizOutput
@contextlib.contextmanager
def graph_stack(filename):
'Generate a call graph for the enclosed context'
go = GraphvizOutput(output_file=filename)
go.output_type = os.path.splitext(filename)[-1][1:]
@bsmithyman
bsmithyman / style.css
Created Feb 10, 2016
vnstat PHP frontend EdgeOS theme
View style.css
body
{
background-color: #3f3f3f;
margin: 8px;
padding: 0;
}
#content
{
width: 898px;
View frameinspect.py
class Blorgle(object):
@property
def incompatible(self):
import inspect
frame = inspect.currentframe()
print('Current')
print(frame.f_locals.get('self', None))
print('Previous')
print(frame.f_back.f_locals.get('self', None))
print('2Prev')
View config-4.2.0-usbarmory-docker
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 4.2.0 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_MIGHT_HAVE_PCI=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
View gb.py
def GB(tag = None):
import sys
if not hasattr(GB, 'badgercount'):
GB.badgercount = 0
sys.stdout.write('Guard badger: %03d is named %s'%(GB.badgercount, 'Stanley' if not tag else tag))
sys.stdout.flush()
GB.badgercount += 1
@bsmithyman
bsmithyman / vnstati.sh
Last active Sep 14, 2015
Crontab entry for vnstati to email
View vnstati.sh
0 7 1 * * (vnstati -m -i eth1 -o /tmp/vnstati.png && uuencode /tmp/vnstati.png /tmp/vnstati.png && vnstati -d -i eth1 -o /tmp/vnstati.png && uuencode /tmp/vnstati.png /tmp/vnstati.png) | mailx -s "Network Usage" brendan@bitsmithy.net
View monospace.sh
#!/bin/bash
cat << END
<html>
<body>
<pre style="font-family: consolas,monospace;font-size:8pt">
END
cat -
@bsmithyman
bsmithyman / LICENSE
Last active Jul 28, 2016
Pure Python implementation of SEG-Y file input; originally from https://github.com/bsmithyman/pygeo.
View LICENSE
Licensed under GNU Lesser General Public License
Originally part of 'pygeo' (also by Brendan Smithyman).
https://www.gnu.org/licenses/lgpl.html
You can’t perform that action at this time.