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 PIL import ImageGrab | |
import time | |
# Windows resolution size query | |
import ctypes | |
user32 = ctypes.windll.user32 | |
screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1) | |
i = 0 | |
while 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
import difflib | |
with open('animals.txt', 'r') as animal_file: | |
animals = [a.strip() for a in animal_file.readlines()] | |
with open('classes.txt', 'r') as class_file: | |
classes = [c.strip() for c in class_file.readlines()] | |
close_matches = [] | |
for c in classes: | |
closest = difflib.get_close_matches(c, animals, n=20, cutoff=0.7) |
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
# Rolling hash | |
# Rabin-Karp Algorithm | |
needle = "you" | |
haystack = "hello, how are you doing this fine day?" | |
s = map(ord, haystack) | |
BASE = max(s) + 1 | |
BIG_PRIME = 472882027 # 15485863 | |
needle_length = len(needle) | |
# large prime | |
""" |
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
let len a = sum (map (\x -> 1) a) |
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 Maze(width, height) { | |
this.cellWidth = 50; | |
this.cellHeight = 50; | |
this.North = 0x01; | |
this.South = 0x02; | |
this.East = 0x04; | |
this.West = 0x08; | |
this.Full = this.North | this.South | this.East | this.West; | |
this.opposite = { |
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
<body> | |
<h1>Music</h1> | |
<button id="play" disabled>Play</button> | |
<section> | |
<canvas id="theCanvas" width="400px" height="400px" style="border: 1px solid black"></canvas> | |
</section> | |
<script> | |
var ctx = document.getElementById("theCanvas").getContext('2d'); | |
var btn = document.getElementById("play"); |
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) { |
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
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
#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; |
NewerOlder