$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices server.c -o server
$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices client.c -o client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _LINUX_LIST_H | |
#define _LINUX_LIST_H | |
#include <stdio.h> | |
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | |
/** | |
* container_of - cast a member of a structure out to the containing structure | |
* @ptr: the pointer to the member. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First-time system setup | |
git config --global user.name "Evans Lai" | |
git config --global user.email "[email protected]" | |
git config --global color.diff auto | |
git config --global color.status auto | |
git config --global color.branch auto | |
git config --global color.log auto | |
git config --global alias.co checkout | |
git config --global core.editor "vim" | |
git config --global core.autocrlf false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/socket.h> | |
#include <sys/ioctl.h> | |
#include <linux/if.h> | |
#include <netdb.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main() | |
{ | |
struct ifreq s; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 列出遠端有哪些 branch | |
git branch -a | |
# If you want to check out a local working branch based on origin/test (checkout remote branch) | |
git checkout -b test origin/test | |
# Create branch $new_branch based on branch $other and switch to it | |
git checkout -b $new_branch $other | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git merge --squash <feature branch> | |
git commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.sb "log --graph --pretty=format:'%Cred%h%Creset %Cgreen(%cr) -%C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset%n' --abbrev-commit --branches" | |
// Oneline | |
git log --pretty="%C(Yellow)%h %C(reset)%ad (%C(Green)%cr%C(reset))%x09 %C(Cyan)%an: %C(reset)%s" --date=short |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://stackoverflow.com/questions/11785936/how-to-find-if-a-process-is-running-in-c? | |
https://stackoverflow.com/questions/6898337/determine-programmatically-if-a-program-is-running | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <dirent.h> | |
#include <sys/types.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"https://github.com/amix/vimrc | |
set runtimepath+=~/.vim_runtime | |
source ~/.vim_runtime/vimrcs/basic.vim | |
source ~/.vim_runtime/vimrcs/filetypes.vim | |
source ~/.vim_runtime/vimrcs/plugins_config.vim | |
source ~/.vim_runtime/vimrcs/extended.vim | |
try | |
source ~/.vim_runtime/my_configs.vim |
OlderNewer