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
fn floor(a: float) -> float { | |
let mut b = a as f64; | |
b = float::floor(b); | |
let c = b as float; | |
return c; | |
} | |
fn permentation() -> ~[int] { | |
let list = ~[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36, | |
103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0, | |
26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56, |
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 math, numpy, random | |
def north(matrix): | |
return numpy.concatenate((matrix[1:,:], matrix[:1,:])) | |
def east(matrix): | |
return numpy.concatenate((matrix[:,-1:], matrix[:,:-1]), 1) | |
def south(matrix): | |
return numpy.concatenate((matrix[-1:,:], matrix[:-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 feedparser | |
import urllib | |
from bs4 import * | |
from urllib2 import urlopen | |
def urlexists(url): | |
try: | |
code = urlopen(url) | |
return True | |
except: | |
return 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
function generatePerm() | |
{ | |
var list = [151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36, | |
103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0, | |
26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56, | |
87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166, | |
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55, | |
46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132, | |
187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109, | |
198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126, |
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 random, math, difflib, uuid | |
def mathround(num): | |
return math.floor(num+0.5) | |
def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"): | |
return ((num == 0) and numerals[0]) or (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b]) | |
def addRandomHexDigits(num): | |
builtstring = "" |
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
#version 120 | |
#extension GL_EXT_texture_array : require | |
#extension GL_EXT_texture_array : enable | |
// Varying. | |
varying vec4 vPos; | |
varying vec3 worldNormal; | |
varying vec3 worldPos; | |
// Global directional light uniforms. |
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 server = createServer("test.com", 8123); | |
server.on('connection', function (client) { | |
console.log("WOW CONN"); | |
}); | |
server.on('end', function (client) { | |
console.log("MUCH DISCONN"); | |
}); |
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 Player::ropeTick(%player) { | |
if(isObject(%player.currentRope)) { | |
%point = %player.currentRope.hook.getPosition(); | |
%player_next_tick = vectorAdd(%player.getPosition(),%player.getVelocity()); | |
%player_distance_next_tick = vectorDist(%player_next_tick, %point); | |
if(%player_distance_next_tick > %player.currentRope.length) { | |
%velocity = %player.getVelocity(); | |
%velocity = vectorNormalize(%velocity); | |
%velocity = vectorMultiply(%velocity, vectorSub(%point, %player.getPosition())); | |
%player.setVelocity(%velocity); |
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 Player::ropeTick(%player) { | |
if(isObject(%player.currentRope)) { | |
%point = %player.currentRope.hook.getPosition(); | |
%player_next_tick = vectorAdd(%player.getPosition(),%player.getVelocity()); | |
%player_distance_next_tick = vectorDist(%player_next_tick, %point); | |
if(%player_distance_next_tick > %player.currentRope.length) { | |
%velocity = %player.getVelocity(); | |
%velocity = vectorNormalize(%velocity); | |
%velocity = vectorScale(%velocity, %player.currentRope.length - vectorDist(%player.getPosition, %player.currentRope.hook.getPosition())); | |
%player.setVelocity(%velocity); |
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
def sbin(toPrint): | |
return "{:0b}".format(toPrint) | |
class OctNode: | |
def __init__(self, parentNode, data): | |
self.parentNode = parentNode | |
#self.position = position | |
self.data = data | |
self.leaf = True |
OlderNewer