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
var canvas = document.getElementById("theCanvas"); | |
var ctx = canvas.getContext("2d"); | |
var middle = {x: canvas.width / 2, y: canvas.height / 2}; | |
var PI2 = Math.PI * 2; | |
var radius = 100; | |
var slices = [25, 50, 25, 100]; | |
var total = slices.reduce(function(a, b) { return a+b; }); |
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
n = [121, 100, 1337, 404, 33] | |
def num_digits(n): | |
digits = 0 | |
while n > 0: | |
n /= 10 | |
digits+= 1 | |
return digits | |
def is_palindrome(n): | |
digits = num_digits(n) |
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 requests | |
from bs4 import BeautifulSoup | |
term = "trigun" | |
url = "http://www.nyaa.se/?page=search&cats=0_0&filter=0&term=%s" % term | |
r = requests.get(url) | |
soup = BeautifulSoup(r.text) | |
titles = soup.select('.tlistname') | |
print titles | |
print [title.contents for title in titles] |
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 requests | |
import binascii | |
from PIL import Image, ImageFile | |
import subprocess | |
r = requests.get("http://webcams.sdes.ucf.edu/webcam/Stream/10", stream=True) | |
# Generate Image Object | |
def gen_image(): | |
p = ImageFile.Parser() | |
start_write = False |
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 socket | |
import sys | |
# For getch... | |
import tty | |
import termios | |
HOST = '192.168.1.8' | |
PORT = 8888 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
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
#include <stdio.h> | |
#include <stdlib.h> | |
// Global / Static aren't in the stack! | |
unsigned long stack_top; | |
unsigned int* location; | |
int main() | |
{ | |
int X = 72, Y = 30; |
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 gtk.gdk | |
import numpy as np | |
import cv2 | |
import subprocess | |
w = gtk.gdk.get_default_root_window() | |
sz = w.get_size() | |
# Get screen pixels | |
pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, sz[0], sz[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
function getSelectionText() { | |
var text = ""; | |
if (window.getSelection) { | |
text = window.getSelection().toString(); | |
} else if (document.selection && document.selection.type != "Control") { | |
text = document.selection.createRange().text; | |
} | |
return text; | |
} | |
var keysDown = {}; |
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
// Train data | |
var xor_data = [ | |
[[0, 0], [0]], | |
[[0, 1], [1]], | |
[[1, 0], [1]], | |
[[1, 1], [0]], | |
]; | |
// helper functions | |
function randomRange(count) { |
OlderNewer