Skip to content

Instantly share code, notes, and snippets.

View kylestev's full-sized avatar

Kyle Stevenson kylestev

  • Portland, Oregon
View GitHub Profile
@kylestev
kylestev / queue.py
Created February 26, 2014 21:09
queue derived from two stacks
class Stack(object):
def __init__(self):
self.arr = []
def __len__(self):
return len(self.arr)
def push(self, obj):
self.arr.append(obj)
class Cursor(object):
def __init__(self):
self.x, self.y = 0, 0
self.dirs = {
'd': (0, 1),
'u': (0, -1),
'r': (1, 0),
'l': (-1, 0)
}
@kylestev
kylestev / fake_location.py
Created July 11, 2014 05:34
Want to fake your location on Tinder? Connect your phone to mitmproxy and run this script and you're good to go.
from libmproxy.script import concurrent
@concurrent
def request(context, flow):
if 'user/ping' in flow.request.path:
flow.request.content = '{"lat":44.563781,"lon":-123.279444}' # Oregon State
@kylestev
kylestev / complexity
Last active August 29, 2015 14:03
cloudinit is, on average, twice as complex as ironic or the ironic-python-agent projects. Example of complex method included.
➜ work radon cc -a ironic/ironic | tail -2
2845 blocks (classes, functions, methods) analyzed.
Average complexity: A (1.96379613357)
➜ work radon cc -a cloud-init/cloudinit | tail -2
960 blocks (classes, functions, methods) analyzed.
Average complexity: A (3.91145833333)
➜ work radon cc -a ironic-python-agent/ironic_python_agent | tail -2
494 blocks (classes, functions, methods) analyzed.
Average complexity: A (2.10526315789)
@kylestev
kylestev / clippy.sh
Created August 24, 2014 07:53 — forked from TSedlar/clippy.sh
#!/bin/bash
function get_clipboard_content {
xclip -selection c -o
}
function upload_pastie {
local lang="plain_text"
local content=$(get_clipboard_content)
local private=1
import json
import requests
import sys
COMPANY_TABLE_ID = 'company_table'
URL_STACKALYTICS = 'http://stackalytics.com/api/1.0/stats'
URL_SA_IRONIC_METRICS = '{}/{}?module={}&metric={}'.format(
URL_STACKALYTICS, '{}', 'ironic-group', '{}')
@kylestev
kylestev / Netflix Blocker
Created May 23, 2012 03:37
Fiddler Netflix blocker using HostList class
import Fiddler;
class Handlers {
static var nopeGif = "<img src=\"http://i.imgur.com/OLRXz.gif\" />";
static var blocked = "<html><head><title>Blocked</title></head><body><h2>Blocked</h2><p>Stop using all my bandwidth!!</p><br />" + nopeGif + "</body></html>";
static var hostList = new HostList("*.netflix.com,*.nflximg.com");
static function OnBeforeRequest(oSession: Session) {
if (hostList.ContainsHost(oSession.hostname)) {
oSession["ui-bold"] = "true";
@kylestev
kylestev / HTTPS redirection
Created May 28, 2012 02:08
HTTP to HTTPS redirection in PHP
<?php
if ($_SERVER['SERVER_PORT'] != 443) {
header(sprintf('Location: https://%s%s', $_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI']));
}
?>
@kylestev
kylestev / Robot C Maze Logic
Created May 30, 2012 17:00
Program used for my high school team's robot
#pragma config(Hubs, S4, HTMotor, none, none, none)
#pragma config(Sensor, S2, sonar, sensorSONAR)
#pragma config(Sensor, S3, touch, sensorTouch)
#pragma config(Motor, mtr_S4_C1_1, motorD, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S4_C1_2, motorE, tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
void move(int motorDPower, int motorEPower, int millis) {
motor[motorD] = motorDPower;
motor[motorE] = motorEPower;
@kylestev
kylestev / remove.py
Last active October 5, 2015 19:08
Wrote this to get rid of an extortion virus. Might expand it more in the future. https://www.virustotal.com/file/7dcf381565eeb4b7ac6b20fd3911a44580aa9e1a0b9b6d078e2d7819ac837e2b/analysis/
import os
import datetime
appdata = os.environ['APPDATA']
log_dir = appdata + '\\dclogs\\'
local_dir = appdata + '\\..\\Local\\'
exes = [local_dir + 'Java.exe', local_dir + 'wmpnet32.exe', local_dir + 'Microsoft\\Windows\\Start Menu\\Programs\\Startup\\WinUpdate.exe']
found = false
print startup