This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stack(object): | |
def __init__(self): | |
self.arr = [] | |
def __len__(self): | |
return len(self.arr) | |
def push(self, obj): | |
self.arr.append(obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', '{}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_SERVER['SERVER_PORT'] != 443) { | |
header(sprintf('Location: https://%s%s', $_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI'])); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer