Skip to content

Instantly share code, notes, and snippets.

View nychng's full-sized avatar

Nai nychng

  • Singapore
View GitHub Profile
from django.core.management.base import BaseCommand
from django.contrib.auth.models import Group
from events.models import Event
from role.models import Role
class Command(BaseCommand):
"""
This is a one time command that updates an event's general users to groups
"""
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = gituser@dev.inmeet.com:/var/git/bbox.git
[branch "dev"]
@nychng
nychng / new_bashrc.sh
Created August 11, 2012 10:46 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux?
# Are you tired of not having your ~/.bash* stuff work the way you expect?
#
# Symlink all of the following to this file:
# * ~/.bashrc
"Git branch
function! GitBranch()
let branch = system("git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* //'")
if branch != ''
return ' Git Branch: ' . substitute(branch, '\n', '', 'g')
en
return ''
endfunction
function! CurDir()
@nychng
nychng / Django Project Code Counter!
Created September 1, 2012 07:19
Django Project Code Counter!
from django.core.management.base import BaseCommand
from django.conf import settings
import os
class Command(BaseCommand):
"""
This counts the code for each app in the project and displays the
lines of code of unit test written.
def test_paypal_callback(self):
response = self.client.login(username=self.user.email, password='foz')
self.assertTrue(response)
# create post params simulation from paypal
order = OrderFactory(event=self.event, cart=self.cart,
payment_method=self.payment_method)
total = '%.2f' % self.total
post_param = {
<script type="text/javascript">
if(typeof(mixpanel) !== "undefined") {
mixpanel.register({
ip_address: 203.126.171.206,
join_date: 03/01/2013
})
mixpanel.name_tag('{&#39;USER_EMAIL&#39;: u&#39;nychng@yahoo.com&#39;}');
mixpanel.identify('{&#39;USER_EMAIL&#39;: u&#39;nychng@yahoo.com&#39;}');
@nychng
nychng / gist:5883607
Created June 28, 2013 09:39
test script for graphite
#!/usr/bin/env python
import socket
import time
CARBON_SERVER = '0.0.0.0'
CARBON_PORT = 2003
message = 'foo.bar.baz 42 %d\n' % int(time.time())
@nychng
nychng / MongoDB plist
Created February 24, 2013 15:27
MongoDB plist
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
<dict>
<key>Label</key><string>org.macports.mongodb</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/daemondo</string>
<string>--label=mongodb</string>
@nychng
nychng / Django Project Code Counter!
Created September 1, 2012 07:26
Django Project Code Counter!
from django.core.management.base import BaseCommand
from django.conf import settings
import os
class Command(BaseCommand):
"""
This counts the code for each app in the project and displays the
lines of code of unit test written.