vim /etc/nginx/sites-enabled/default
upstream app-a {
server 127.0.0.1:3000;
}
server {
vim /usr/bin/b2b
#! /usr/bin/env python
import sys
from_num, from_base = (sys.argv[1].split('/') + ["10"])[:2]
if len(sys.argv) > 2:
require 'rubypython' | |
arg1, arg2, arg3 = 800, 900, 1000 | |
RubyPython.start | |
np = RubyPython.import("numpy") | |
@result = np.random.triangular(arg1, arg2, arg3, 100000).to_a.map(&:to_s).map(&:to_f) | |
RubyPython.stop | |
puts @result |
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()
{
<?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; |
#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); | |
} |
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 |
// 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'" | |
} |
SCRIPT_PATH=$(dirname $(readlink -f $0)) | |
echo $SCRIPT_PATH |