Skip to content

Instantly share code, notes, and snippets.

View xi4oh4o's full-sized avatar
🎯
Focusing

Howe Yong xi4oh4o

🎯
Focusing
View GitHub Profile
@xi4oh4o
xi4oh4o / v2ex-xh-custom-theme.css
Created October 15, 2011 12:54
The V2EX custom theme
View v2ex-xh-custom-theme.css
:root {
padding-top: 40px;}
#SteveJobs {
display: none !important;}
#Top {
position: fixed;
top: 0;
width: 100%;
@xi4oh4o
xi4oh4o / v2ex-pb3-top-style.css
Last active October 4, 2015 11:08
V2EX PB3 Top Style
View v2ex-pb3-top-style.css
:root {
padding-top: 40px;}
#Top {
background: rgb(240,241,241);
background: -moz-linear-gradient(top, rgba(240,241,241,1) 0%, rgba(235,237,238,1) 51%, rgba(225,225,225,1) 51%, rgba(191,199,203,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(240,241,241,1)), color-stop(51%,rgba(235,237,238,1)), color-stop(51%,rgba(225,225,225,1)), color-stop(100%,rgba(191,199,203,1)));
background: -webkit-linear-gradient(top, rgba(240,241,241,1) 0%,rgba(235,237,238,1) 51%,rgba(225,225,225,1) 51%,rgba(191,199,203,1) 100%);
background: -o-linear-gradient(top, rgba(240,241,241,1) 0%,rgba(235,237,238,1) 51%,rgba(225,225,225,1) 51%,rgba(191,199,203,1) 100%);
background: -ms-linear-gradient(top, rgba(240,241,241,1) 0%,rgba(235,237,238,1) 51%,rgba(225,225,225,1) 51%,rgba(191,199,203,1) 100%);
@xi4oh4o
xi4oh4o / ssh_proxy_login
Created November 19, 2012 08:11
ssh auto login script
View ssh_proxy_login
#!/usr/bin/expect -f
set port you_port
set user you_user
set host you_ip
set password you_pass
set timeout -1
spawn ssh -nNTf -D $port $user@$host
expect "*assword:*"
@xi4oh4o
xi4oh4o / find_fastserver.sh
Created December 13, 2012 12:58
find fast server for mac
View find_fastserver.sh
#/bin/bash
#By LordSimon
#Modify xi4oh4o
#ping -c 1 ssh.sshcenter.info
for i in $(seq 21) #will 21 modify you server number count
do
@xi4oh4o
xi4oh4o / auto_restart_webserver.sh
Last active September 1, 2021 19:10
Auto restart phpfpm on 502 & 504 Error also save logs
View auto_restart_webserver.sh
#!/bin/bash
MY_URL="http://moefou.org" #change you website
RESULT_502=`curl -I $MY_URL|grep "HTTP/1.1 502"`
RESULT_504=`curl -I $MY_URL|grep "HTTP/1.1 504"`
if [ -n "$RESULT_502" ]; then
killall php-fpm;php-fpm
date>>/data/logs/web_error.log;echo "502 Bad Gateway">>/data/logs/web_error.log
elif [ -n "$RESULT_504" ]; then
killall php-fpm;php-fpm
date>>/data/logs/web_error.log;echo "504 Gateway Time-out">>/data/logs/web_error.log
View custom_vimrc
if has("gui_running")
set go=aAce
set transparency=10
set guifont=Monaco:h13
set showtabline=2
set columns=140
set lines=40
syn on
set bs=2
set showmatch
@xi4oh4o
xi4oh4o / .vimrc
Last active December 25, 2015 03:49
vimrc
View .vimrc
" MAIN CUSTOMIZATION FILE
"
" Enable loading filetype and indentation plugins
filetype plugin on
filetype indent on
" Turn syntax highlighting on
syntax on
@xi4oh4o
xi4oh4o / .vimrc.bundles
Created November 3, 2013 02:41
NeoBundles
View .vimrc.bundles
if has('vim_starting')
set nocompatible " Be iMproved
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
----
call neobundle#rc(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/vimproc'
NeoBundle 'othree/html5.vim'
NeoBundle 'altercation/vim-colors-solarized'
@xi4oh4o
xi4oh4o / statistical_day_lines_of_code
Created February 21, 2014 04:16
Git statistical day lines of code
View statistical_day_lines_of_code
git log --author="$(git config --get user.name)" --pretty=tformat: --numstat --since=1am \
| gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }'
@xi4oh4o
xi4oh4o / rails_resources.md
Created April 22, 2014 05:29 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.
View rails_resources.md

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h