Skip to content

Instantly share code, notes, and snippets.

View yuchen's full-sized avatar
🌴
On vacation

clark yuchen

🌴
On vacation
  • china, shanghai
  • 19:54 (UTC +08:00)
View GitHub Profile
@yuchen
yuchen / cors-nginx.conf
Created November 18, 2015 12:22 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@yuchen
yuchen / free-memory.rb
Created November 12, 2015 07:02 — forked from vigo/free-memory.rb
"free" command for osx. Shows available memory
#!/usr/bin/env ruby
# encoding: utf-8
# By Uğur Özyılmazel, @vigobronx | @ugurozyilmazel
# http://vigodome.com | http://ugur.ozyilmazel.com | http://github.com/vigo
def get_paged_memory_usage(match_string, paging=4096)
mvar = 3
if match_string.split(/[^\w]/).length > 1
mvar = 4
@yuchen
yuchen / _ide_helper.php
Created November 5, 2015 13:51 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.1.1 (LTS) on 2015-06-11.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@yuchen
yuchen / xhprof
Created November 3, 2015 06:37 — forked from andboson/xhprof
laravel xhprof snip wget http://pecl.php.net/get/xhprof-0.9.4.tgz tar xvf xhprof-0.9.4.tgz php -S localhost:9999
define("XHPROF_ROOT", '/var/www/xhprof-0.9.4');
App::before(function(){
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
});
App::after(function(){
require_once (XHPROF_ROOT . '/xhprof_lib/utils/xhprof_lib.php');
require_once (XHPROF_ROOT . '/xhprof_lib/utils/xhprof_runs.php');
@yuchen
yuchen / README.md
Last active August 29, 2015 14:16 — forked from mbbx6spp/README.md

Best UNIX Shell tools

These are a list of usages of shell commands I can't live without on UNIX-based systems.

Install

Mac OS X

Using Homebrew (yes, I am opinionated) you can install the following tools with the following packages:

XWindows for Headless Selenium

X Wing art by Paul Harckham

How to set up a Headless Selenium Testing environment for CentOS 6.3.

On your CentOS 6.3 host

Follow these steps to set up a CentOS 6.3 host to run headless Selenium tests with Firefox.

@yuchen
yuchen / Int64.js
Last active August 29, 2015 14:10 — forked from lttlrck/Int64.js
nodejs big int (64bits) package
// Int64.js
//
// Copyright (c) 2012 Robert Kieffer
// MIT License - http://opensource.org/licenses/mit-license.php
/**
* Support for handling 64-bit int numbers in Javascript (node.js)
*
* JS Numbers are IEEE-754 binary double-precision floats, which limits the
* range of values that can be represented with integer precision to:
// modules
var redis = require('redis');
var Step = require('step');
// config file
var config = require('config');
// mysql client connect
var mysql = require('mysql');
var connection = mysql.createConnection({
@yuchen
yuchen / mount-ram.sh
Last active August 29, 2015 14:06 — forked from koshigoe/mount-ram.sh
#!/bin/sh
# This program has two feature.
#
# 1. Create a disk image on RAM.
# 2. Mount that disk image.
#
# Usage:
# $0 <dir> <size>
#
@yuchen
yuchen / logger.winston.js
Last active August 29, 2015 14:06 — forked from rtgibbons/logger.js
winston sample
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',