Skip to content

Instantly share code, notes, and snippets.

@CrBoy
CrBoy / README
Created September 12, 2011 06:31
Plurk CSS (original by howar31)
這個 CSS 樣式表最初由 howar31 製作, CrBoy 為了記錄改寫的過程所以放上 gist.github。
This stylesheet is originally made by howar31. CrBoy put it on gist.github for modifying and improving.
@CrBoy
CrBoy / .gitignore
Created June 27, 2011 02:44
Plurk Mobile Unread_* Auto Opener
.DS_Store
@CrBoy
CrBoy / Makefile
Created June 14, 2011 10:28
Something test about C++ exception handling
all: set_new_hand set_unexpected set_terminate
set_new_hand: set_new_hand.cpp
g++ -g -o set_new_hand set_new_hand.cpp
set_unexpected: set_unexpected.cpp
g++ -g -o set_unexpected set_unexpected.cpp
set_terminate: set_terminate.cpp
g++ -g -o set_terminate set_terminate.cpp
@CrBoy
CrBoy / PalindromicStack.cpp
Created April 19, 2011 19:50
print out a palindromic stack implemented by template meta programming XD
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
template<size_t max> string inc_seq()
{
string s;
for(int i=1; i<=max; i++)
@CrBoy
CrBoy / valgrind_massif_example1
Created April 19, 2011 16:29
這是關於 valgrind massif 的輸出範例
--------------------------------------------------------------------------------
MB
9.096^ #
| @:@#
| @:::@:@#
| @:::@@@:: @:@#
| @:: @ @:: @:@#
| @@:: @ @:: @:@#
@CrBoy
CrBoy / dec2bin.cpp
Created April 16, 2011 17:58
convert decimal to binary
#include <iostream>
#include <bitset>
using namespace std;
int main ()
{
int x;
cout<<"Please input one number: ";
cin>>x;
cout << bitset<32>(x) << endl;
function _ps1_git(){
local ref cnt branch clean
ref=$(git symbolic-ref HEAD 2> /dev/null)
cnt=$(git branch 2> /dev/null|grep -c -E '*')
branch=$(echo "${ref#refs/heads/}")
if [[ "${branch}" == "" ]]
then
return
fi
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
@CrBoy
CrBoy / README
Created March 8, 2011 06:41
An example showing why to use fgets() instead of gets() to prevent buffer overflow
http://www.ithome.com.tw/itadm/article.php?c=66229
encoding_utf8: encoding_utf8.c
gcc -o encoding_utf8 encoding_utf8.c
# I forget how to use variables....orz
#enc-$.c: encoding_utf8 $.c
# ./encoding_utf8 <$.c >enc-$.c
#
#$: enc-$.c
# gcc -o $ enc-$.c