Skip to content

Instantly share code, notes, and snippets.

View calvinchengx's full-sized avatar
:octocat:
Focusing

Calvin Cheng calvinchengx

:octocat:
Focusing
View GitHub Profile
from fabric.api import env
from functools import wraps
def get_target_name(f):
@wraps(f)
def wrapper(*args, **kwargs):
print("I am in the decorator")
for key, value in env.project_sites.iteritems():
for k, v in value.iteritems():
def show_sudo_users_and_groups(ug, nopasswd):
"""
Helper function that prints out users and groups with sudo (or no passwd sudo) rights.
"""
ug_users = []
ug_groups = []
nopasswd_string = ""
if nopasswd:
nopasswd_string = "no password "
import os
import sys
from threading import Thread, Lock
from Queue import Queue
def report(message):
mutex.acquire()
print message
sys.stdout.flush()
mutex.release()
import os
import sys
for roots, dirlist , filelist in os.walk(os.curdir):
for file in [os.path.join(roots,filegot) for filegot in filelist]:
if "bz2" not in file:
print "Compressing %s" % (file)
os.system("bzip2 %s" % file)
print ":DONE"
{
"data": [
{
"name": "Lessons learnt from Redmart by @Sebastian Deckers",
"start_time": "2013-12-13T13:00:00+0800",
"timezone": "Asia/Singapore",
"location": "Plug-In@Blk71",
"id": "595830510477311"
},
{
package event
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/suite"
@calvinchengx
calvinchengx / gist:24cf8c48fcd2f0182704
Created May 28, 2014 07:36
Example module export for nodejs libraries
var sjcl = require('sjcl');
var RNCryptor = {};
/*
Takes password string and salt WordArray
Returns key bitArray
*/
module.exports.KeyForPassword = RNCryptor.KeyForPassword = function(password, salt) {
@calvinchengx
calvinchengx / Example Nodejs
Created May 28, 2014 07:36
Example module export for nodejs libraries
var sjcl = require('sjcl');
var RNCryptor = {};
/*
Takes password string and salt WordArray
Returns key bitArray
*/
module.exports.KeyForPassword = RNCryptor.KeyForPassword = function(password, salt) {
@calvinchengx
calvinchengx / SassMeister-input-HTML.html
Created February 16, 2015 06:17
Generated by SassMeister.com.
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<title>Ophto App</title>
</head>
<body>
@calvinchengx
calvinchengx / SassMeister-input-HTML.html
Created February 16, 2015 06:22
Generated by SassMeister.com.
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<title>Ophto App</title>
</head>
<body>