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
#ifndef NSMALLPOSINTS | |
#define NSMALLPOSINTS 257 | |
#endif | |
#ifndef NSMALLNEGINTS | |
#define NSMALLNEGINTS 5 | |
#endif | |
#if NSMALLNEGINTS + NSMALLPOSINTS > 0 | |
/* References to small integers are saved in this array so that they | |
can be shared. | |
The integers that are saved are those in the range |
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 | |
from collections import defaultdict | |
def parse_config(conf): | |
def Tree(): | |
return defaultdict(Tree) | |
data = Tree() |
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
""" Dice rolling simulator, will ask user to press Enter to roll. | |
Will print a random number between 1 to 6. Will ask user if they want to roll again. """ | |
import random | |
print "Welcome to the Dice Rolling Simulator!\n" | |
print "Press Enter to roll the dice." | |
begin = raw_input("") | |
""" function where random numbers are generated """ |
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
//global | |
"ZreknarF":["cdn.frankerfacez.com/channel/global/ZreknarF.png"], | |
"LilZ":["cdn.frankerfacez.com/channel/global/LilZ.png"], | |
"BeanieHipster":["cdn.frankerfacez.com/channel/global/BeanieHipster.png"], | |
"ManChicken":["cdn.frankerfacez.com/channel/global/ManChicken.png"], | |
"YellowFever":["cdn.frankerfacez.com/channel/global/YellowFever.png"], | |
"YooHoo":["cdn.frankerfacez.com/channel/global/YooHoo.png"], | |
//00greenbean00 | |
"BeanAhab":["cdn.frankerfacez.com/channel/00greenbean00/BeanAhab.png"], | |
"BeanHori":["cdn.frankerfacez.com/channel/00greenbean00/BeanHori.png"], |
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 | |
class Point(): | |
__slots__ = ('x', 'y') | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y |
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 <GL3/gl3w.h> | |
#include <GL/glfw.h> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <glm/glm.hpp> | |
#include <glm/gtc/matrix_transform.hpp> | |
#include <glm/gtc/type_ptr.hpp> |
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 bitap_search(text, pattern): | |
""" | |
Returns position of pattern in text or -1 if it wasn't found. | |
text and pattern are strings. | |
>>> bitap_search("test text", "tex") | |
5 | |
>>> bitap_search("test text", "z") | |
-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
In [1]: l1 = [[[0]*3]*3]*3 | |
In [2]: l1 | |
Out[2]: | |
[[[0, 0, 0], [0, 0, 0], [0, 0, 0]], | |
[[0, 0, 0], [0, 0, 0], [0, 0, 0]], | |
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]] | |
In [3]: l1[0][0][0] = 'x' |
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 A(object): | |
def x(self): | |
return self.x.y | |
x.y = 123 | |
class B(object): | |
def x(self): | |
return B.x.y | |
x.y = 123 |
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 A(object): | |
def x(cls): | |
return cls.x.y | |
x.y = 123 | |
x = classmethod(x) |
OlderNewer