Skip to content

Instantly share code, notes, and snippets.

View rgegriff's full-sized avatar

George Griffin rgegriff

  • NYC
View GitHub Profile
@rgegriff
rgegriff / scrape.py
Created July 27, 2012 02:08
A script to download all of the epubs from a calibre library
#!/bin/env python
#python scrape.py "http://some.url.nyud.net/"
import urllib, re, sys, time, shutil
url = sys.argv[1]
search_str = "mobile?search=;order=descending;sort=author;num=10000000;start=1"
epub_list = [l for l in re.findall('href=[\"\'](.[^\"\']+)[\"\']', urllib.urlopen(url+search_str).read(), re.I) if l[-4:] == "epub"]
if len(sys.argv) == 3:
print "RESUMING AT #"+str(sys.argv[2])
count = int(sys.argv[2])
__author__ = 'george griffin'
import urllib2, os, shutil, string
import xml.etree.cElementTree as ET
baseurl = "http://tuebl.com"
xmlns = "{http://www.w3.org/2005/Atom}"
def filenameize(s):
return "".join([x for x in s if x.isalpha() or x.isdigit() or x in string.whitespace])
08332a345a6d4213b76b60e86050a88f
sudo apt-get update
sudo apt-get install bash
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
env X='() { (a)=>\' bash -c "echo date"; cat echo
@rgegriff
rgegriff / designer.html
Last active August 29, 2015 14:17
designer
<link rel="import" href="../core-pages/core-pages.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../speech-mic/speech-mic.html">
@rgegriff
rgegriff / designer.html
Last active August 29, 2015 14:17
designer
<link rel="import" href="../paper-calculator/paper-calculator.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<polymer-element name="my-element">
<template>
<style>
:host {
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
{
"id": 1,
"name": "A green door",
"price": 12.50,
"tags": ["home", "green"]
}
def mesij_decode(s):
s = s.replace("\r\n","")
normal = '~'+string.uppercase+string.lowercase+string.digits+"+/"
rev = "".join(reversed(normal))
rev = "="+rev[:-1]
transtab = string.maketrans(normal, rev)
ts = string.translate(s, transtab)
print normal+"\n"+rev+"\n"+s+"\n"+ts
return base64.b64decode(ts)
@rgegriff
rgegriff / impersonate.py
Created August 1, 2016 21:32
Impersonate python sessions
email = "User@email.com"
user = User.objects.get(email__icontains=email)
[s for s in Session.objects.all() if "_auth_user_id" in s.get_decoded() and int(s.get_decoded()['_auth_user_id']) == user.id]