Skip to content

Instantly share code, notes, and snippets.

View KevOrr's full-sized avatar
💣
status' OR 1=1; --

Kevin Orr KevOrr

💣
status' OR 1=1; --
View GitHub Profile
@KevOrr
KevOrr / zipfclips.c
Last active April 18, 2016 03:07
Simulates zipfian behaviors among paperclips
// Simulates zipfian behaviors among paperclips
// Assumes that all paperclips can be selected with equal probability,
// regardless of the chain size each is in.
#include <stdio.h>
#include <stdlib.h>
struct clip {
int id;
struct clip *prev;
#!/usr/bin/env python3
from statistics import mean, stdev
def squared_error_cost(hypothesis, data):
return sum( (hypothesis(point[:-1]) - point[-1])**2 for point in data ) / 2*len(data)
def linear_optimize_gradient_descent(data, args, alpha=.01, max_iters=1000):
"""Takes a sequence of n-tuples, where n-1 is the number of features of the model, and the last index is the output"""
data = [(1,) + tuple(point) for point in data]
@KevOrr
KevOrr / Extra Buttons For Perichat.md
Last active August 29, 2015 14:06
Perichat Buttons
import time, urllib, sys
from html.parser import HTMLParser
from requests.exceptions import HTTPError
import praw, flask
from flask import Flask, make_response, render_template, url_for
from bs4 import BeautifulSoup as BS
LIMIT = 300 # Limit the number of comments fetched in `search`.
@KevOrr
KevOrr / peri_people_effeciency.txt
Created August 13, 2014 07:39
/r/Periwinkle Posters and Commentors, sorted by score effeciency
donny_brook 66.0
hradium 65.0
timelordstallywacker 58.0
theredditsurvivalist 53.5
gusissupercool 46.0
harbingerofthelight 40.0
basoran 33.0
periwinkledownman 30.0
cleverboy1 27.5
ashx3 26.0
@KevOrr
KevOrr / peri_people_by_upvotes.txt
Created August 13, 2014 06:52
/r/Periwinkle Posters and Commentors, sorted by upvotes
lolzrfunni 1555
redis213 1551
tiercel 1241
naughtypenguin 980
sahdee 951
cdos93 908
i_am_telekinetic 766
rockdalerooster 763
myductape 520
zwoosh 493
@KevOrr
KevOrr / peri_people.txt
Created August 13, 2014 02:15
/r/Periwinkle Posters and Commentors, sorted by activity (activity = # of Posts + # of Comments)
tiercel 290
lolzrfunni 233
redis213 221
sahdee 209
rockdalerooster 140
meshugganah 133
naughtypenguin 118
cdos93 115
myductape 105
i_am_telekinetic 102
import sys
import praw
from requests.exceptions import HTTPError
r = praw.Reddit('elabot')
p = r.get_subreddit('periwinkle')
errors = []
seen = set()
players = {}
@KevOrr
KevOrr / main.txt
Created July 30, 2014 18:03
Compilebot + Echobot Proof of Concept
+/u/someEchobot
+/u/CompileBot
from urllib.requests import urlopen
text = urlopen('http://tiny.cc/compileechobotpoc').read().decode()
print(text)