Skip to content

Instantly share code, notes, and snippets.

View DarkSector's full-sized avatar
🏗️
Building stuff

Pronoy Chopra DarkSector

🏗️
Building stuff
View GitHub Profile
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__
return self.func(*args)
File "tweet.py", line 98, in status_mentions
mentns = self.api.mentions()
AttributeError: authentication instance has no attribute 'api'
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__
@DarkSector
DarkSector / adduser.py
Created August 9, 2011 21:19
user addition
@app.route('/add_user', methods=['GET', 'POST'])
def add_user():
if request.method == 'POST':
email_entered = request.form['email']
password_entered = request.form['password']
unidentified = User.query.filter_by(email=email_entered).first()
exists = unidentified is None
"""
syntax:
<Table>.query.filter_by(<field>=<data>).first()
@DarkSector
DarkSector / hardontest.love
Created December 1, 2011 20:51
A simple markup example to use the HardonCollider
HC = require "hardoncollider"
function love.load( )
love.graphics.setBackgroundColor(255,255,255,255)
-- color set to white
HC.init(100, on_collision)
-- a new hardoncollider instance
@DarkSector
DarkSector / jQuery CDN fallback
Created April 18, 2012 16:54
Fallback for the jQuery CDN import
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='/js/jquery-1.7.1.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<style type="text/css">
.link {
stroke: #232323;
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<style type="text/css">
.link {
stroke: #23ff23;
}
{"nodes":[{"name":"Myriel","group":1},{"name":"Napoleon","group":1},{"name":"Mlle.Baptistine","group":1},{"name":"Mme.Magloire","group":1},{"name":"CountessdeLo","group":1},{"name":"Geborand","group":1},{"name":"Champtercier","group":1},{"name":"Cravatte","group":1},{"name":"Count","group":1},{"name":"OldMan","group":1},{"name":"Labarre","group":2},{"name":"Valjean","group":2},{"name":"Marguerite","group":3},{"name":"Mme.deR","group":2},{"name":"Isabeau","group":2},{"name":"Gervais","group":2},{"name":"Tholomyes","group":3},{"name":"Listolier","group":3},{"name":"Fameuil","group":3},{"name":"Blacheville","group":3},{"name":"Favourite","group":3},{"name":"Dahlia","group":3},{"name":"Zephine","group":3},{"name":"Fantine","group":3},{"name":"Mme.Thenardier","group":4},{"name":"Thenardier","group":4},{"name":"Cosette","group":5},{"name":"Javert","group":4},{"name":"Fauchelevent","group":0},{"name":"Bamatabois","group":2},{"name":"Perpetue","group":3},{"name":"Simplice","group":2},{"name":"Scaufflaire","group":2},
@app.route('/panel/product/upload/image', methods=['POST'])
def upload_product_image():
image_name = flask.request.args['qqfile']
product_image_path = os.path.join(app_config('PRODUCT_IMAGES'), image_name)
product_thumbnail_path = os.path.join(app_config('PRODUCT_IMAGES_THUMBNAILS'), image_name)
with open(product_image_path, 'w') as fh:
fh.write(flask.request.stream.read())
@DarkSector
DarkSector / attempt1
Last active December 30, 2015 12:39
Matlab video manipulation
clc;
clear;
% Start with importing the video
vidObj = VideoReader('/Users/DarkSector/Desktop/vid.avi');
% Once loaded lets get the first frame and choose an ROI on it
frame1 = read(vidObj, 1);