启动新会话:
tmux [new -s 会话名 -n 窗口名]
恢复会话:
tmux at [-t 会话名]
#include <functional> | |
namespace functional { | |
template <typename Function> struct function_traits; | |
template <typename ClassType, typename ReturnType, typename... Args> | |
struct function_traits<ReturnType(ClassType::*)(Args...) const> { | |
using function = const std::function<ReturnType(Args...)>; | |
}; |
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
SCRIPT_PATH=$(dirname $(readlink -f $0)) | |
echo $SCRIPT_PATH |
// Get Environment Variable from $FILE and Set to Current Environment | |
function ExtractEnv () { | |
FILE_PATH=$1 | |
ITEM_NAME=$2 | |
VALUE=`cat $FILE_PATH | awk 'BEGIN{FS="="}{ if ($1 ~ /\s*'$ITEM_NAME'\s*/) print $0}' | sed 's/^\s*'$ITEM_NAME'\s*=\s*//'` | |
eval "$ITEM_NAME='$VALUE'" | |
} |
git config --global alias.co checkout | |
git config --global alias.ci commit | |
git config --global alias.st status | |
git config --global alias.br branch | |
git config --global alias.df diff | |
git config --global alias.cur "rev-parse --abbrev-ref HEAD" # get current branch |
#include <stdio.h> | |
/* | |
如果要在 main 用 d ,那跟在 A 用 *a 或在 B 用 b 意思是一樣的 | |
但如果要在 main 用 &d ,那跟在 B 用 &b 意思是不一樣的,切記要用 A 的 a 當做做法 | |
*/ | |
void A (int **a) { | |
printf("A: *a: %p\n", *a); | |
printf("A: a: %p\n", a); | |
} |
<?php | |
// https://blog.ladsai.com/php-utf8-%E7%B0%A1%E7%B9%81%E8%BD%89%E6%8F%9B.html#more-141 | |
function gb2312_to_big5($str) | |
{ | |
global $utf8_gb2312, $utf8_big5; | |
$str_t = ''; | |
$len = strlen($str); | |
$a = 0; |
If a c-str is created dynamically (calloc/malloc), we can't get it's memory size dynamically in any way. :'(
http://stackoverflow.com/questions/419022/char-x256-vs-char-malloc256sizeofchar
#include <stdio.h>
#include <stdlib.h>
int main()
{