This file contains hidden or 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
# Define models | |
roles_users = db.Table('roles_users', | |
db.Column('user_id', db.Integer(), db.ForeignKey('user.id')), | |
db.Column('role_id', db.Integer(), db.ForeignKey('role.id'))) | |
# Role table | |
class Role(db.Model, RoleMixin): | |
id = db.Column(db.Integer(), primary_key=True) | |
name = db.Column(db.String(80), unique=True) |
This file contains hidden or 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 chunks(l, n): | |
"""Yield successive n-sized chunks from l.""" | |
for i in range(0, len(l), n): | |
yield l[i:i + n] | |
This file contains hidden or 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]: %load_ext autoreload | |
In [2]: %autoreload 2 | |
In [3]: from foo import some_function | |
In [4]: some_function() | |
Out[4]: 42 | |
In [5]: # open foo.py in an editor and change some_function to return 43 |
This file contains hidden or 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
#!env sh | |
base64 /dev/urandom | head -c 10000000 > 10MB.txt |
This file contains hidden or 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() { | |
var num; | |
sorted(random.sample([ | |
(function() { | |
var i, len, ref, results; | |
ref = range(1, 46); | |
results = []; | |
for (i = 0, len = ref.length; i < len; i++) { | |
num = ref[i]; |
This file contains hidden or 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
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 6eafe619-9856-1e4c-857f-3c7b8157e144" -d '{ | |
"title": "New logo", | |
"body": "We should have one", | |
"labels": ["design"] | |
}' "https://api.github.com/repos/maxtortime/python-lotto/issues?access_token=" |
This file contains hidden or 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
/* Remove trailing newline, . */ | |
if ((strlen(name)>0) && (name[strlen (name) - 1] == '\n')) | |
name[strlen (name) - 1] = '\0'; |
NewerOlder