Skip to content

Instantly share code, notes, and snippets.

@huydx
huydx / gist:8911290
Created February 10, 2014 06:28
therubyracer-mavericks
brew tap homebrew/dupes # Thanks Tom
brew install apple-gcc42
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
brew uninstall v8
gem uninstall libv8
@huydx
huydx / gist:9406254
Created March 7, 2014 06:19
thrift error
gem install thrift -- --with-cppflags='-D_FORTIFY_SOURCE=0'
@huydx
huydx / .gitconfig
Created April 11, 2014 07:22
.gitconfig
[core]
pager = less
editor = vim
[alias]
ci = commit -v
st = status
di = diff
co = checkout
br = branch
l = log --date=local
@huydx
huydx / diag.rb
Last active August 29, 2015 13:59
diag.rb
require 'net/ping'
require 'colorize'
require 'terminal-notifier'
class InternetDiagnosis
def initialize
@host = 'www.google.com'
@concurrency = 3
@prev_error = nil
end
@huydx
huydx / deep_struct.rb
Created April 15, 2014 08:54
deep_struct.rb
# deep_struct.rb
require 'ostruct'
class DeepStruct < OpenStruct
def initialize(hash=nil)
@table = {}
@hash_table = {}
if hash
hash.each do |k,v|
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
$! raise された例外オブジェクト
$" require で読み込まれたファイルの配列
$#
$$ 現在のプロセス ID
$%
$& 正規表現にマッチした箇所の文字列
$' 正規表現にマッチした箇所より後ろの文字列
$(
$)
$* Ruby スクリプトに指定された引数。ARGV と同じ

Assuming you llvm installed (comes as standard on Mac OS Mavrick xtools)

Create a helloworld.c file:

  #include<stdio.h>
  
  int main()
  {
 int x=3;