Skip to content

Instantly share code, notes, and snippets.

Nai nychng

Block or report user

Report or block nychng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nychng
nychng / gist:5883607
Created Jun 28, 2013
test script for graphite
View gist:5883607
#!/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())
View gist:5069814
<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;}');
View Test Paypal
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 = {
View 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 Sep 1, 2012
Django Project Code Counter!
View 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.
@nychng
nychng / Django Project Code Counter!
Created Sep 1, 2012
Django Project Code Counter!
View 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.
View gist:3423858
"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 / new_bashrc.sh
Created Aug 11, 2012 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
View new_bashrc.sh
#!/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
View gist:3214198
[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"]
View gist:3033889
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
"""
You can’t perform that action at this time.