Skip to content

Instantly share code, notes, and snippets.

View binki's full-sized avatar

Nathan Phillip Brink binki

View GitHub Profile
@binki
binki / mutt-user.eml
Last active October 5, 2015 22:18
outlook vs mozilla mailnews (mutt)
Return-Path: <jsmith@ohnopublishing.net>
X-Original-To: ohnobinki@ohnopublishing.net
Delivered-To: ohnobinki@ohnopublishing.net
Received: by ohnopublishing.net (Postfix, from userid 1017)
id 8AD22B7AAC; Mon, 5 Oct 2015 22:06:40 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ohnopublishing.net;
s=ohnopublishing; t=1444082800;
bh=T8tiW+eBSVtcylt4kR1D1AdHP48z83nE08oeuBjj3ak=;
h=Date:From:To:Subject:References:In-Reply-To;
b=h6qbIEv5isIqnMGraVXDTFviA8dMqWvjKUYHoNoWFDK6rrh2rsDphsasyQiF40S0+
@binki
binki / gist:edb9c7c87cae83a3cac3
Created October 14, 2015 18:04
artem’s echo
ohnobinki@gibby ~/MusclePharm $ busybox telnet sam.ohnopub.net 10005
HTTP/1.0 200 Ok
Content-Type: text/plain
Readme: Hello there
Hello! Welcome to this server!
Type 'quit' to terminate it. Type an empty line to drop this connection.
Type something other to display it on exit.
other
@binki
binki / hgpy.cmd
Last active October 21, 2015 18:05
Run python with any Windows mercurial install
@getattr(''' 2>NUL
@ECHO OFF
: # Ignore any ERRORLEVEL infection attempt
SET ERRORLEVEL=
hg --config extensions.runcmd=%0\..\hgpy.cmd -- %*
EXIT /B %ERRORLEVEL%
''', 'format')
def n():
pass
@binki
binki / gist:61d739ecd2b158049f62
Created October 23, 2015 17:11
no need for closing(open()) for with
>>> f = open('c:\\users\\ohnob\\appdata\\local\\temp\\f.txt', 'w')
>>> with f as fi:
... fi.write('hi')
...
2
>>> f.write('there')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: I/O operation on closed file.
@binki
binki / banner.py
Created October 30, 2015 21:30
banner.p as a python literal rather than a pickle
banner = [[(' ', 95)], [(' ', 14), ('#', 5), (' ', 70), ('#', 5), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 6), ('#', 3), (' ', 6), ('#', 4), (' ', 3), ('#', 3), (' ', 9), ('#', 3), (' ', 7), ('#', 5), (' ', 3), ('#', 3), (' ', 4), ('#', 5), (' ', 3), ('#', 3), (' ', 10), ('#', 3), (' ', 7), ('#', 4), (' ', 1)], [(' ', 3), ('#', 3), (' ', 3), ('#', 2), (' ', 4), ('#', 4), (' ', 1), ('#', 7), (' ', 5), ('#', 2), (' ', 2), ('#', 3), (' ', 6), ('#', 4), (' ', 1), ('#', 7), (' ', 3), ('#', 4), (' ', 1), ('#', 7), (' ', 5), ('#', 3), (' ', 2), ('#', 3), (' ', 5), ('#', 4), (' ', 1)], [(' ', 2), ('#', 3), (' ', 5), ('#', 3), (' ', 2), ('#', 5), (' ', 4), ('#', 4), ('
@binki
binki / banner.json
Created October 30, 2015 21:39
banner.p as JSON rather than a python2 pickle
[[[" ", 95]], [[" ", 14], ["#", 5], [" ", 70], ["#", 5], [" ", 1]], [[" ", 15], ["#", 4], [" ", 71], ["#", 4], [" ", 1]], [[" ", 15], ["#", 4], [" ", 71], ["#", 4], [" ", 1]], [[" ", 15], ["#", 4], [" ", 71], ["#", 4], [" ", 1]], [[" ", 15], ["#", 4], [" ", 71], ["#", 4], [" ", 1]], [[" ", 15], ["#", 4], [" ", 71], ["#", 4], [" ", 1]], [[" ", 15], ["#", 4], [" ", 71], ["#", 4], [" ", 1]], [[" ", 15], ["#", 4], [" ", 71], ["#", 4], [" ", 1]], [[" ", 6], ["#", 3], [" ", 6], ["#", 4], [" ", 3], ["#", 3], [" ", 9], ["#", 3], [" ", 7], ["#", 5], [" ", 3], ["#", 3], [" ", 4], ["#", 5], [" ", 3], ["#", 3], [" ", 10], ["#", 3], [" ", 7], ["#", 4], [" ", 1]], [[" ", 3], ["#", 3], [" ", 3], ["#", 2], [" ", 4], ["#", 4], [" ", 1], ["#", 7], [" ", 5], ["#", 2], [" ", 2], ["#", 3], [" ", 6], ["#", 4], [" ", 1], ["#", 7], [" ", 3], ["#", 4], [" ", 1], ["#", 7], [" ", 5], ["#", 3], [" ", 2], ["#", 3], [" ", 5], ["#", 4], [" ", 1]], [[" ", 2], ["#", 3], [" ", 5], ["#", 3], [" ", 2], ["#", 5], [" ", 4], ["#", 4], [" ", 3], ["
@binki
binki / encapsulation_try1.py
Last active December 16, 2015 07:53
Encapsulation enforcement in python? weakref required
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import abc
# Define an abstract class for our public interface.
class Human(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def eat(self):
@binki
binki / faker.sql
Last active December 29, 2015 18:38
T-SQL flow control: `DECLARE` with default is like `SET`, labels inside of constructs
DECLARE @done BIT = 0;
IF 1=0
BEGIN
faker:
PRINT 'x';
SET @done = 1;
END
DECLARE @not BIT = @done;
PRINT @not;
IF @done = 0
@binki
binki / .gitignore
Last active January 4, 2016 15:40
Some code which requires either C99/C11.
*.exe
*.o
blah-c11
#!/usr/bin/env python
import csv, io
with io.StringIO() as os:
writer = csv.writer(os)
writer.writerow(['hi', 'bye'])
writer.writerow(['there', 'here'])
# You would figure out how to pass this to your email system
print(os.getvalue())