Skip to content

Instantly share code, notes, and snippets.

@puentesarrin
puentesarrin / FileSplitter.py
Last active February 16, 2021 05:19 — forked from msharp/FileSplitter.py
python script to split a (large) file into multiple (smaller) files with specified number of lines
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
class FileSplitter(object):
def __init__(self):
self.parse_args(sys.argv)
diff --git a/ad_codes/models/__init__.py b/ad_codes/models/__init__.py
index 5abedab..75bc44f 100644
--- a/ad_codes/models/__init__.py
+++ b/ad_codes/models/__init__.py
@@ -20,12 +20,12 @@ class AdCodesFields(object):
tablet = fields.StringField()
amp = fields.StringField()
ia = fields.StringField()
+ display = fields.BooleanField(default=False)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import raven
CURRENT = os.path.dirname(__file__)
sys.path.insert(0, os.path.realpath(os.path.join(CURRENT, '..', '..')))
sys.path.insert(1, os.path.realpath(os.path.join(CURRENT, '..', '..', 'rebelmouse')))
@puentesarrin
puentesarrin / ez_setup.py.diff
Created April 25, 2016 18:30
Setuptools quickfix :)
➜ ~ diff ez_setup.py ez_setup.py.edited
331c331
< url = download_base + zip_name
---
> url = 'https://pypi.python.org/packages/86/ee/622e83b0dbede6d48891ed209fa5ca83fcc485f9b6696cf56796eda40806/{}'.format(zip_name)
> db.collection.insert({primary_tag: 'dog', secondary_tags: ['dogs', 'doggy', 'puppy']})
> var tags = []
> db.collection.find({'$or': [{'primary_tag': {'$in': tags}}, {'secondary_tags': {'$in': tags}}]}).explain()
{
"cursor" : "BasicCursor",
"isMultiKey" : false,
"n" : 0,
"nscannedObjects" : 1,
"nscanned" : 1,
"nscannedObjectsAllPlans" : 1,
class BadgeManager(Manager) # This equals your BaseBadgeManager
def get_by_id(self, roar_id, id_or_ids):
pass
def drop(self, roar_id, badge_id):
pass
class BaseBadge(models.Model):
import motor
from functools import partial
from tornado import gen, ioloop, web
class MyHandler(web.RequestHandler):
@gen.coroutine
def get(self):
import pymongo
db = pymongo.MongoClient().school
for student in db.students.find():
hws = {s['score']: i for i, s in enumerate(student['scores'])
if s['type']=='homework'}
index = hws[min(hws.keys())]
del student['scores'][index]
@puentesarrin
puentesarrin / zsh.md
Created June 11, 2014 19:29 — forked from tsabat/zsh.md
@puentesarrin
puentesarrin / week_1.txt
Last active August 29, 2015 14:02
M101J Week 1 & 2 Video List
M101J Week 1 Video List
https://www.youtube.com/watch?feature=player_embedded&v=FN10crzDOjk
https://www.youtube.com/watch?feature=player_embedded&v=ysg0vfgg6fI
https://www.youtube.com/watch?feature=player_embedded&v=q2iLKZ1LgjI
https://www.youtube.com/watch?feature=player_embedded&v=CAR42sMkXEo
https://www.youtube.com/watch?feature=player_embedded&v=-KIC1LXxcGM
https://www.youtube.com/watch?feature=player_embedded&v=IAvnMgvHuLw
https://www.youtube.com/watch?feature=player_embedded&v=swhH4q_2Ttc
https://www.youtube.com/watch?feature=player_embedded&v=f-lyGAMnNY4