Skip to content

Instantly share code, notes, and snippets.

View gtback's full-sized avatar

Greg Back gtback

  • Indiana, US
  • 18:55 (UTC -05:00)
View GitHub Profile
@gtback
gtback / sed1line.txt
Created December 29, 2020 15:47
Handy one-liners for SED
# This version from https://web.archive.org/web/20160823204639/https://www-rohan.sdsu.edu/doc/sed.html
HANDY ONE-LINERS FOR SED (Unix stream editor) Mar. 23, 2001
compiled by Eric Pement <[email protected]> version 5.1
Latest version of this file is usually at:
http://www.student.northpark.edu/pemente/sed/sed1line.txt
http://www.cornerstonemag.com/sed/sed1line.txt
This file is also available in Portuguese at:
http://www.lrv.ufsc.br/wmaker/sed_ptBR.html
@gtback
gtback / turnstyle.py
Created December 7, 2019 21:18
Turnstyle
def generator():
for x in range(10):
yield x
class Turnstyle:
def __init__(self):
self.counter = 0
def count(self, iterable):
for item in iterable:
@gtback
gtback / keybase.md
Created January 28, 2018 05:29
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@gtback
gtback / caesar.py
Created August 14, 2016 04:14
Simple demonstration of shift ciphers
a = "QCRWBUWGBHTIB"
for key in range(26):
print(key, "".join([chr((ord(x) - ord("A") + key) % 26 + ord("A")) for x in a]))
@gtback
gtback / copy-hooks.sh
Created August 31, 2015 14:25
Install git hooks
#!/bin/bash
cd ../.git/hooks
echo PWD: $PWD
for i in $( ls ../../hooks ); do
echo command: ln -s ../../hooks/$i .
ln -v -sf ../../hooks/$i .
done
@gtback
gtback / contagio_unzip.py
Last active March 23, 2021 04:25
Contagio Unzip
#!/usr/bin/env python
"""
Extract malware from Contagio Zip files, determining the password
automatically.
Note that the password for each zip file consists of a common base password
along with the last character of the file name (prior to the .zip extension).
If you don't know the base password, please contact Mila directly.
@gtback
gtback / superclasses.py
Last active August 29, 2015 14:12
Python Super types
class X(object):
@classmethod
def dostuff(cls, arg):
print "In X.dostuff: %s, %s" % (cls, arg)
class Y(X):
@classmethod
def dostuff(cls, arg):
@gtback
gtback / xml-versions
Last active August 29, 2015 14:08
Check LXML Versions
#!/usr/bin/env python
from lxml import etree
print "lxml.etree: ", etree.LXML_VERSION
print "libxml used: ", etree.LIBXML_VERSION
print "libxml compiled: ", etree.LIBXML_COMPILED_VERSION
print "libxslt used: ", etree.LIBXSLT_VERSION
print "libxslt compiled: ", etree.LIBXSLT_COMPILED_VERSION