Skip to content

Instantly share code, notes, and snippets.

View kitsunde's full-sized avatar
💭
Poisoning pigeons in the park

Kit Sunde kitsunde

💭
Poisoning pigeons in the park
View GitHub Profile
@kitsunde
kitsunde / gist:3665628
Created September 7, 2012 12:05
pytz working for Singapore
>>> import pytz
>>> from datetime import datetime
>>> time_zone = pytz.timezone('Asia/Singapore')
>>> my_time = datetime.utcnow()
>>> my_time
datetime.datetime(2012, 9, 7, 12, 6, 15, 56631)
>>> my_time.replace(tzinfo=pytz.utc)
datetime.datetime(2012, 9, 7, 12, 6, 15, 56631, tzinfo=<UTC>)
>>> my_time = my_time.replace(tzinfo=pytz.utc)
>>> my_time.astimezone(time_zone)
@kitsunde
kitsunde / closethread.py
Created July 16, 2013 08:49
Disqus owner cannot close threads.
>>> PUBLIC_KEY = 'TkhL2k0lvpvb5KIiN8l0E1tcMAEguAXy8rPOheJfwkjUGdrWLZSJIr2Mv2Dnyhy1'
>>> SECRET_KEY = 'notmykey'
>>> ACCESS_TOKEN = 'alsonotmykey'
>>> disqus = DisqusAPI(SECRET_KEY, PUBLIC_KEY)
>>> disqus.users.details(access_token=ACCESS_TOKEN)
{'favicon': {'cache': 'https://securecdn.disqus.com/1373918630/images/favicon-default.png',
'permalink': 'https://disqus.com/api/forums/favicons/transformbusiness.jpg'},
'founder': '61541387',
'id': 'transformbusiness',
@kitsunde
kitsunde / components.video-component.js
Last active September 8, 2017 15:58
<video> doesn't get muted
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'video',
attributeBindings: ['_muted:muted', 'playsinline', 'autoplay', 'src', 'controls'],
_muted: Ember.computed(function(){
return true;
}),
muted: true,
playsinline: true,
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
openModal(){
this.sendAction('openModal');
}
}
});
### Keybase proof
I hereby claim:
* I am kitsunde on github.
* I am kitsunde (https://keybase.io/kitsunde) on keybase.
* I have a public key ASDNjRB3ZAPxi1xab21wLv786J5Q_dSF2n3qWeNC0vUtago
To claim this, I am signing this object:
@kitsunde
kitsunde / pre-commit
Created August 25, 2014 11:36
ESLint lint pre_commit hook
#!/usr/bin/env node
var exec = require('child_process').exec;
var fs = require('fs');
var eslint = require('../node_modules/eslint/lib/cli');
var files;
var child = exec("git diff-index --cached --name-only HEAD", function(error, stdout, stderr){
files = stdout.split('\n').filter(function(i){
@kitsunde
kitsunde / terraform.tf
Created December 28, 2015 12:26
Terraform AWS provision.
# We control the existance of the build-server by setting this to 0 or 1
variable "build_servers" {
}
provider "aws" {
access_key = "<aws_key>"
secret_key = "<aws_secret>"
region = "us-east-1"
}
@kitsunde
kitsunde / foo.txt
Created August 16, 2013 20:23
Shows repeated calls to repos not being cached.
git+git://github.com/Celc/facebook-sdk.git@05ef99bbd2eab3dced959cbd913b2719772a1861#egg=facebook-sdk
git+git://github.com/bmihelac/django-import-export.git@e3087e4dc7b0a191587c2a890035286c065f4971#egg=import-export
upstream cuteletter{
server 127.0.0.1:8000;
}
server {
listen 80;
listen 9001 default_server;
server_name www.cuteandfluffythings.com cuteandfluffythings.com;
access_log /var/log/nginx/cuteletter.access.log;
var collidables = new Collidables();
function GameObject(){
this.collidable = new Collidable({
get: function(){
return new BoundingBox(this.x,
this.y,
this.x + this.width,
this.y + this.height);
},