Skip to content

Instantly share code, notes, and snippets.

View beefy's full-sized avatar
✌️

Nate Schultz beefy

✌️
  • Zendesk
  • Philadelphia, PA
  • 17:50 (UTC -04:00)
View GitHub Profile
@beefy
beefy / type.py
Created June 3, 2016 16:33
Generate keyboard input, useful if "paste" is unusable
import win32com.client
import time
shell = win32com.client.Dispatch("WScript.Shell")
type_str = 'KexAlgorithms diffie-hellman-group1-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1'
time.sleep(3)
shell.SendKeys(type_str)
@beefy
beefy / username.py
Created June 2, 2016 15:59
a script to help find a github username
#!/usr/bin/env python2.7
import urllib2
for line in open('/usr/share/dict/cracklib-small','rb'):
try:
urllib2.urlopen('https://github.com/'+line.replace('\n',''))
except urllib2.HTTPError as e:
if e.code == 404:
print line.replace('\n','')
@beefy
beefy / crash.py
Created May 12, 2016 13:55
A small python script that will crash your computer (not tested thoroughly)
import itertools
for a,b,c in itertools.product(itertools.count(0),xrange(0,10),xrange(0,10)):
print a,b,c
if a > 20: break
@beefy
beefy / suffix_tree_demo.py
Created May 10, 2016 16:15
A suffix tree class with longest repeated substring implemented
class suffix_tree():
def __init__(self,input_str):
self.root = node(ptr=[])
for i in range(0,len(input_str)):
self.add(self.root,input_str[i:])
# add if input_str never starts with vals in node.ptr
# otherwise, add to node that starts with it
# if a val in node.ptr starts with input_str
@beefy
beefy / funcs.py
Last active May 19, 2016 00:31
Python mathy functions, in no particular order
import math
import operator
# primality test
def is_prime(i):
if i <= 1: return False
if i <= 3: return True
if i%3 == 0 or i%2 == 0: return False
return sum((1 for y in xrange(5, int(i**0.5)+1, 6) if i%y == 0 or i%(y+2) == 0)) == 0
@beefy
beefy / NetworkTask.java
Last active April 15, 2016 02:33
encoding Unicode (including emojis) for web server
String[] msg_chars = new String[msg_text.length()];
for(int i=0; i < msg_text.length(); i++) {
msg_chars[i] = "\\" +String.valueOf(String.format("\\u%04x", (int) msg_text.charAt(i)));
}
msg_text = ""
for(int i=0; i < msg_chars.length; i++) {
msg_text += msg_chars[i];
}
@beefy
beefy / instagram_dentist_bot.py
Last active May 4, 2016 18:29
A web crawler/scrapper for the Instagram API, never perfected/finished
__author__ = 'Nathaniel'
import requests
import mysql.connector
import time
import unicodedata
# region sql stuff
def sql_filter_param(text):
output = unicodedata.normalize('NFKD', text).encode('ascii','ignore');