Skip to content

Instantly share code, notes, and snippets.

View mgrandi's full-sized avatar

Mark Grandi mgrandi

  • Arizona, USA
View GitHub Profile
@idan
idan / oauthlib_twitter_example.py
Created May 2, 2012 22:50
Requests + OAuth, sample usage
import requests
from requests.auth import OAuth1
url = u'https://api.twitter.com/1/account/settings.json'
client_key = u'...'
client_secret = u'...'
resource_owner_key = u'...'
resource_owner_secret = u'...'
@canni
canni / enum.py
Last active November 5, 2015 02:11
SQLAlchemy Enum column type using python's enum34
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from enum import Enum
from sqlalchemy.types import SchemaType, TypeDecorator
from sqlalchemy.types import Enum as SAEnum
class EnumType(SchemaType, TypeDecorator):
def __init__(self, enum, name):
@Nezzerath
Nezzerath / simple irc python bot
Created January 9, 2013 09:05
python simple irc bot
import sys
import socket
import string
import os
import threading
import time
import random
windowtitle = "Nezzbot IRC Client"
from os import system
system("title "+windowtitle)
@shinohai
shinohai / Nyan.sh
Created March 27, 2015 19:34
A Bash Nyan Cat For Fun
#!/bin/bash
# config
IMGS=(
"
+ o + o \n\
+ o + +\n\
o + \n\
o + + + \n\
+ o o + o\n\
@mid-kid
mid-kid / messagetool.py
Created September 26, 2015 10:34
Unpack and repack Pokemon Super Mystery Dungeon's message.bin
from sys import argv
from struct import unpack, unpack_from, pack
from os import makedirs
from os.path import isdir
from json import dumps, loads
def unpack_wchar_str_from(bytes, pos):
string = b""
@jonbarrow
jonbarrow / archive.py
Last active April 11, 2021 04:24
Rip SMM1 course data and metadata from Nintendo's servers using NEX
'''
Credit Jonathan Barrow 2021
This will rip courses from SMM1 using NEX to automate the process
Use at your own risk, I am not resposible for any bans
Requires Python 3 and https://github.com/Kinnay/NintendoClients
Licensed under GNU GPLv3
'''
@0xabad1dea
0xabad1dea / severscam.md
Last active July 12, 2021 01:32
Sever Scam

The Scammiest Scam To Yet Anonymity Scam

I'm still holding out for this being a hoax, a big joke, and that they're going to cancel the kickstarter any minute. It'd be quite the cute "lessons learned" about anonymity scams. However, I will be treating it from here on out as a genuine scam. (As of May 2nd, the kickstarter has been cancelled, after the strangest attempt to reply to this imaginable. Good riddance.)

This absolutely ridiculous thing was brought to my attention by a friend and since it was late at night I thought I must be delirious in how absurdly over the top fake it seemed. So I slept on it, woke up, and found that it had gotten a thousand dollars more funding and was every bit as flabbergasting as I thought it was.

Since I realize that not everyone has spent their entire lives studying computers – and such people are the targets of such scams –

# you can make a text file of request times (in ms, one number per line) and import it here, or you can use a probability distribution to simulate request times (see below where setting req_durations_in_ms)
# rq = read.table("~/Downloads/request_times.txt", header=FALSE)$V1
# argument notes:
# parallel_router_count is only relevant if router_mode is set to "intelligent"
# choice_of_two, power_of_two, and unicorn_workers_per_dyno are only relevant if router_mode is set to "naive"
# you can only select one of choice_of_two, power_of_two, and unicorn_workers_per_dyno
run_simulation = function(router_mode = "naive",
reqs_per_minute = 9000,
@briangordon
briangordon / git-review-aliases.txt
Last active September 16, 2022 17:51
Aliases for code reviewing GitHub pull requests using a GitFlow/OneFlow branching model
*****************************************************************************************************************************
Introduction
The code review workflow that I prefer is to check out a feature branch, then `reset --soft` to move the branch HEAD to
just before the changes. That way I still have all of the changes in my working copy, and those exact changes are staged
for commit. My IDE will highlight the changed lines right in the editor and let me click the gutter to view a quick diff.
This is incredibly useful. But problems arise when develop has been merged into a running PR, bringing along a whole bunch
of other unrelated changes that have already been reviewed. I don't want all of those other changes to be highlighted in
my IDE, but I do want them in my working copy.
@crmccreary
crmccreary / AESCipher.py
Created May 20, 2013 02:17
Encryption using pycrypto, AES, and PKCS5 padding
from Crypto.Cipher import AES
from Crypto import Random
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
class AESCipher:
def __init__( self, key ):
"""