상품상세 게시판 추가정보 양식 (나인 스타일)

/* 추가정보검색 버튼 수정  */
.review_options_search__option_type:first-child {
    margin-left: 15px;
}
.review_options_search__option_type {
    border: 1px solid #383838;
    min-width: 130px;
    max-width: 170px;
    height: 30px;
    margin-right: 15px;
}
.review_options_search__option_type_dropdown_button {
    border-left: 1px solid #383838;
    width: 38px;
    height: 30px;
}
.review_options_search__option_type_name {
    font-size: 13px;
}
.products_reviews_header {
    position: relative;
    margin-top: 85px;
}
.products_reviews_header__lower {
    position: absolute;
    top: -85px;
    left: 357px;
}
.review_options_search__option_type_link {
    line-height: 32px;
}
.review_options_search__values {
    min-width: 96px;
}
.review_options_search__title {
    text-align: center;
    width: 626px;
    margin-bottom: 20px;
}
.review_options_search__dropdown_menu {
    width: 130px;
    top: 31px;
}
.products_reviews_gallery__body {
    margin-top: 70px;
}

전체게시판 추가정보 양식 (나인 스타일)

/* 추가정보검색 버튼 수정  */
.review_form__submit {
    background: #fff;
    color: #000000;
    border: 1px solid #dadada;
}
.review_form__submit:hover {
    background: #fff;
    color: #000000;
    border: 1px solid #dadada !important;
}
.review_form__submit_title_icon {
    display: none;
}

/* 추가정보검색 버튼 수정  */
.review_options_search__option_type:first-child {
    margin-left: 15px;
}
.review_options_search__option_type {
    border: 1px solid #383838;
    min-width: 130px;
    max-width: 170px;
    height: 30px;
    margin-right: 15px;
}
.review_options_search__option_type_dropdown_button {
    border-left: 1px solid #383838;
    width: 38px;
    height: 30px;
}
.review_options_search__option_type_name {
    font-size: 13px;
}
.products_reviews_header {
    position: relative;
    margin-top: 85px;
}
.products_reviews_header__lower {
    position: absolute;
    top: -90px;
    left: 246px;
}
.review_options_search__option_type_link {
    line-height: 32px;
}
.review_options_search__values {
    min-width: 96px;
}
.review_options_search__title {
    text-align: center;
    width: 626px;
    margin-bottom: 20px;
}
.review_options_search__dropdown_menu {
    width: 130px;
    top: 31px;
}

proxmox

#proxmox cluster

#clear
cd /
systemctl stop pve-cluster
systemctl stop corosync

pmxcfs -l
rm /etc/pve/corosync.conf
rm -rf /etc/corosync/*
rm -rf /var/lib/corosync/*

ls /etc/pve/nodes

umount -l /etc/pve

killall pmxcfs
systemctl start pve-cluster

Start Sass server

Cenergi
sass --watch ./sass/custom-editor-style.scss:css/theme.css

deployment of django

https://www.dropbox.com/s/jb5zycels34e3ug/deployment.pdf?dl=0

Linux环境配置

Linux环境配置
<img align="right" src="https://github.com/guoli100/conf/blob/master/headicon.jpg" width="36" height="36"></img>

# 新装系统环境配置
## 基于APT-based系统(Debian, Ubuntu, Mint, etc.)

### 1. 安装[shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev)
- 从PPA安装[ppa:max-c-lv/shadowsocks-libev](https://launchpad.net/~max-c-lv/+archive/ubuntu/shadowsocks-libev)
```zsh
$ sudo add-apt-repository ppa:max-c-lv/shadowsocks-libev
$ sudo apt update
$ sudo apt install -y shadowsocks-libev
$ sudo add-apt-repository -r ppa:max-c-lv/shadowsocks-libev
```
- Systemd shadowsocks-libev service start ss-server by default, if working as client,  
edit `/lib/systemd/system/shadowsocks-libev.service` and replace `ss-server` to `ss-local`.  
May also need to edit `/etc/init.d/shadowsocks-libev` and replace `ss-server` to `ss-local`.

### 2.安装[genpac](https://github.com/JinnLynn/genpac),设置系统代理
```zsh
$ pip install genpac

# 生成autoproxy.pac文件
$ genpac -c ~/conf/genpac/config.ini

# 在LinuxMint下通过cinnamon-settings打开系统设置->网络->网络代理
# 使用自动设置,URL填写'file:///home/username/autoproxy.pac'
```

### 3. 安装[Git](https://github.com/git/git)
- 从PPA安装[ppa:git-core/ppa](https://launchpad.net/~git-core/+archive/ubuntu/ppa)
```zsh
$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt update
$ sudo apt install -y git
```
- 从源代码安装[git](https://github.com/git/git/blob/master/INSTALL)
```zsh
$ cd
$ sudo apt install -y build-essential autoconf asciidoc xsltproc
$ curl -L https://github.com/git/git/archive/master.zip -o git.zip
$ unzip git.zip
$ cd git-master
$ make configure
$ ./configure --prefix=/usr
$ make all doc
$ sudo make install install-doc install-html

```

- 配置git
```zsh
$ git config --global user.name guoli100
$ git config --global user.email golotv@163.com
$ git config --global credential.helper 'cache --timeout=86400'
$ git config --global http.proxy socks5://127.0.0.1:1080
$ git config --global https.proxy socks5://127.0.0.1:1080
$ git config --global core.editor vim
```

### 4. 安装[Proxychains-ng](https://github.com/rofl0r/proxychains-ng)
```zsh
$ sudo apt install -y build-essential
$ git clone https://github.com/rofl0r/proxychains-ng.git
$ cd proxychains-ng
$ ./configure --prefix=/usr --sysconfdir=/etc
$ make
$ sudo make install
$ sudo make install-config (installs proxychains.conf)
```

### 5. 安装[zsh](https://github.com/zsh-users/zsh) and [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
- 从源代码安装[zsh](https://github.com/zsh-users/zsh/blob/master/INSTALL)
```zsh
$ cd
$ sudo apt install -y build-essential autoconf perl libncurses5-dev yodl
$ git clone https://github.com/zsh-users/zsh.git
$ cd zsh
$ ./Util/preconfig
$ ./configure --prefix=/usr --bindir=/bin
$ make
$ sudo make install
$ which zsh | sudo tee -a /etc/shells
$ chsh -s "$(which zsh)"
```
登出当前shell后再重新登入,启用zsh
- 安装[oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
```zsh
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
```
- 安装[zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions)插件
```zsh
$ git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
```

### 6. 安装Vim
- 从PPA安装[ppa:jonathonf/vim](https://launchpad.net/~jonathonf/+archive/ubuntu/vim)(Notice that this Vim don't have python compiled)
```zsh
$ sudo add-apt-repository ppa:jonathonf/vim
$ sudo apt update
$ sudo apt install -y vim
```
- 从源代码安装[Vim](https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source)
```zsh
$ sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 lua5.1-dev libperl-dev
$ sudo apt remove vim vim-runtime gvim
$ cd ~
$ git clone https://github.com/vim/vim.git
$ cd vim
$ ./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/ \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 --enable-cscope --prefix=/usr
$ make VIMRUNTIMEDIR=/usr/share/vim/vim80
$ sudo make install
$ sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 1
$ sudo update-alternatives --set editor /usr/bin/vim
$ sudo update-alternatives --install /usr/bin/vi vi /usr/bin/vim 1
$ sudo update-alternatives --set vi /usr/bin/vim
```
- 安装[Vundle](https://github.com/VundleVim/Vundle.vim)
```zsh
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
$ cp ~/conf/.vimrc ~
$ vim +PluginInstall +qall
```
- 配置[YouCompleteMe](https://github.com/Valloric/YouCompleteMe)插件
```zsh
$ sudo apt-get install build-essential cmake python-dev python3-dev
$ cd ~/.vim/bundle/YouCompleteMe
$ ./install.py --clang-completer
```
- 如果VIM里显示YCM启动不成功,有可能是YCM安装脚本自动下载的LLVM版本不对,可以参考[Full Installation Guide](https://github.com/Valloric/YouCompleteMe#full-installation-guide),自己手动安装
    - 从[LLVM](http://releases.llvm.org/download.html)官网下载最新版本的Clang压缩包并解压到`~/llvm`
    - 编译ycm_core库
```zsh
$ cd ~
mkdir ycm_build
$ cd ycm_build
$ cmake -G "Unix Makefiles" . -DPATH_TO_LLVM_ROOT=~/llvm ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
$ cmake --build . --target ycm_core
```
- 安装[Powerline fonts](https://github.com/powerline/fonts)
```zsh
$ cd ~
$ git clone https://github.com/powerline/fonts.git
$ cd fonts
$ ./install.sh
```

### 7. 安装[tmux](https://github.com/tmux/tmux)
```zsh
$ cd
$ sudo apt install -y build-essential libevent-dev libncurses5-dev autoconf automake pkg-config
$ git clone https://github.com/tmux/tmux.git
$ cd tmux
$ sh autogen.sh
$ ./configure
$ make
$ sudo make install
```
- 安装[oh-my-tmux](https://github.com/gpakosz/.tmux)
```zsh
$ cd
$ git clone https://github.com/gpakosz/.tmux.git
$ ln -s -f .tmux/.tmux.conf .
$ cp ~/conf/.tmux.conf.local .
```

### 8. 安装virtualenv及[autoenv](https://github.com/kennethreitz/autoenv)
```zsh
# 安装virtualenv
$ sudo apt install -y virtualenv
$ mkdir py3project
$ cd py3project
$ virtualenv -p python3 venv
$ source venv/bin/activate

# 安装autoenv
$ git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv
# 在python项目目录下新建.env和.env.leave文件,并在文件里写入shell命令
```

### 9. 安装[google-chrome](https://www.google.com/chrome/browser/desktop/index.html)
- 从[google](https://www.google.com/chrome/browser/desktop/index.html)下载deb安装包
- 或者使用[google linux repository](https://www.google.com/linuxrepositories/)
```zsh
$ wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
$ sudo sh -c "echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google-chrome.list"
$ sudo apt update
$ sudo apt install -y google-chrome-stable
# 设置google通过pac代理上网
$ google-chrome --proxy-pac-url='file:///home/username/autoproxy.pac'
```

### 10. 安装powerline fonts
参考[Powerline](https://github.com/powerline/fonts)
```zsh
# clone
$ git clone https://github.com/powerline/fonts.git --depth=1
# install
$ cd fonts
$ ./install.sh
# clean-up a bit
$ cd ..
$ rm -rf fonts
```

### 11. 设置fontconfig-infinality
- 安装fontconfig-infinality
```zsh
$ sudo add-apt-repository ppa:no1wantdthisname/ppa
$ sudo apt update
$ sudo apt install -y fontconfig-infinality
```
- 创建font style (Reference /etc/fonts/infinality/README)
```zsh
$ cd /etc/fonts/infinality/styles.conf.avail
$ sudo cp -rp linux linux-zh
$ cd linux-zh
$ sudo rm 20-aliases-default-linux.conf
$ sudo cp ~/conf/fontconfig-infinality/20-aliases-default-linux.conf .
$ sudo cp ~/conf/fontconfig-infinality/62-group-chinese-fonts.conf .
$ sudo cp ~/conf/fontconfig-infinality/63-group-chinese-fonts-rendering.conf .
```	
- 运行infctl.sh设置style
```zsh
$ cd /etc/fonts/infinality
$ ./infctl.sh setstyle linux-zh
```

nginx的原子操作

nginx的原子操作
typedef long ngx_atomic_int_t;
typedef unsigned long ngx_atomic_uint_t; 
typedef volatile ngx_atomic_uint_t ngx_atomic_t;

/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */


#if (NGX_SMP)
#define NGX_SMP_LOCK  "lock;"
#else
#define NGX_SMP_LOCK
#endif


/*
 * "cmpxchgq  r, [m]":
 *
 *     if (rax == [m]) {
 *         zf = 1;
 *         [m] = r;
 *     } else {
 *         zf = 0;
 *         rax = [m];
 *     }
 *
 *
 * The "r" is any register, %rax (%r0) - %r16.
 * The "=a" and "a" are the %rax register.
 * Although we can return result in any register, we use "a" because it is
 * used in cmpxchgq anyway.  The result is actually in %al but not in $rax,
 * however as the code is inlined gcc can test %al as well as %rax.
 *
 * The "cc" means that flags were changed.
 */

static ngx_inline ngx_atomic_uint_t
ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
    ngx_atomic_uint_t set)
{
    u_char  res;

    __asm__ volatile (

         NGX_SMP_LOCK
    "    cmpxchgq  %3, %1;   "
    "    sete      %0;       "

    : "=a" (res) : "m" (*lock), "a" (old), "r" (set) : "cc", "memory");

    return res;
}


/*
 * "xaddq  r, [m]":
 *
 *     temp = [m];
 *     [m] += r;
 *     r = temp;
 *
 *
 * The "+r" is any register, %rax (%r0) - %r16.
 * The "cc" means that flags were changed.
 */

static ngx_inline ngx_atomic_int_t
ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add)
{
    __asm__ volatile (

         NGX_SMP_LOCK
    "    xaddq  %0, %1;   "

    : "+r" (add) : "m" (*value) : "cc", "memory");

    return add;
}


#define ngx_memory_barrier()    __asm__ volatile ("" ::: "memory")

#define ngx_cpu_pause()         __asm__ ("pause")

Tutorial Regex

# Manual Básico de Regex

* Local para testar online: https://regex101.com/
* Tag /g no final indica que a busca não para no primeiro resultado encontrado!
* Se for armazenada em uma variável JS, não pode estar entre aspas duplas

```js
/ninja/.test('ninja'); // retorna true
/ninja/.test('ginja'); // retorna false
```

### Verificação por OU (usando [])
```js
/[ng]inja/.test('ninja'); // retorna true
/[ng]inja/.test('ginja'); // retorna true
/[ng]inja/.test('linja'); // retorna false
```

### Verificação por NOT (usando ^)
```js
/[^a]inja/.test('ninja'); // retorna true
/[^n]inja/.test('ginja'); // retorna true
/[^ngl]inja/.test('linja'); // retorna false
```

### Verificação por NOT (usando ^)
```js
/[a-z]inja/.test('ninja'); // retorna true
/[a-z]inja/.test('Ginja'); // retorna false, só minúsculas
/[a-z]inja/i.test('Ginja'); // retorna true, letra i no final (insensitive)
```


### Verificação por REPETIÇÃO (usando + e {})
```js
/[ninja]+/.test('ninjaninjaninjaninja'); // retorna true, o + deixa eu escrever a string infinitas vezes
/[ninja]{2}/.test('ninjaninja'); // retorna true, valor entre {} especifica quantas vezes
/[ninja]{1,4}/.test('ninjaninja'); // retorna true, reconhece de 1 a 4 vezes
```

### Verificação por METACARACTERES (usando \)
```js
/\d\s\w/.test('ninja'); // retorna false, pois esperava dígito, espaço e letra
/\d\s\w/.test('1 d'); // retorna true
```

### Verificação por OPCIONALIDADE DO CARACTER ANTERIOR (usando ?)
```js
/ninja?/.test('ninj'); // retorna true, pois o caracter a se torna especial (anterior)
```


### Verificação por QUALQUER CARACTERE (usando .)
```js
/ninja./.test('ninjaX'); // retorna true, pois aceita a palavra ninja e qualquer caracter na 6ª posição
/ninja./.test('ninja'); // retorna false, pois falta o sexto caracter

```

### Verificação por QUANTIDADE EXATA DE CARACTERES (usando ^ e $)
```js
/^[a-z]{5}$/.test('ninjaXX'); // retorna false, pois há 7 caracteres
/^[a-z]{5}$/.test('ninja'); // retorna true pois há exatamente 5 caracteres

```

### Verificação por OU (usando () e |)
```js
/(p|t)yre/.test('pyre'); // retorna true
/(p|t)yre/.test('tyre'); // retorna true

```

install via pip for requirments.txt

pip install -r requirements.txt

查询构造器

<?php
$result = Db::name('data')
    ->where('id', 1)
    ->find();

$result = Db::name('data')
    ->where('id', '=', 1)
    ->find();

$result = Db::name('data')
    ->where('id', '>=', 1)
    ->limit(10)
    ->select();
    
$result = Db::name('data')
	// id 是 1、2、3 其中的数字
    ->where('id', 'in', [1, 2, 3])
    ->select();
    
$result = Db::name('data')
    // id 在 5到8之间的
    ->where('id', 'between', [5, 8])
    ->select();
    
// 多个字段查询
$result = Db::name('data')
// id 在 1到3之间的
    ->where('id', 'between', [1, 3])
// name 中包含think
    ->where('name', 'like', '%think%')
    ->select();
    
// 查询null
$result = Db::name('data')
  ->where('name', 'null')
  ->select();
  
// 批量查询
$result = Db::name('data')
    ->where([
        'id'   => ['between', '1,3'],
        'name' => ['like', '%think%'],
    ])->select();
    
// 视图查询
$result = Db::view('user','id,name,status')
    ->view('profile',['name'=>'truename','phone','email'],'profile.user_id=user.id')
    ->where('status',1)
    ->order('id desc')
    ->select();

// 闭包查询
$result = Db::name('data')->select(function ($query) {
    $query->where('name', 'like', '%think%')
        ->where('id', 'in', '1,2,3')
        ->limit(10);
});

// 获取id为8的data数据的name字段值
$name = Db::name('data')
    ->where('id', 8)
    ->value('name');
    
// 获取data表的name列
$list = Db::name('data')
    ->where('status', 1)
    ->column('name');
    
// 统计data表的数据
$count = Db::name('data')
    ->where('status', 1)
    ->count();

// 统计user表的最高分
$max = Db::name('user')
    ->where('status', 1)
    ->max('score');

フォルダの存在を確認して作成する

フォルダが有るかどうかチェックし、ないなら作る
    Dim FolderName As String    '作成したいフォルダパスを格納'
    FolderName = "C:\VBA_Sample\AAA"
    
    If Dir(FolderName, vbDirectory) = "" Then   '同名のフォルダがない場合フォルダを作成'
        MkDir FolderName
    End If

设置简化url

# 在apche里设置DocumentRoot
# 还需要在hosts文件里把tp5.com指向本地的127.0.0.1
<VirtualHost *:80>
    DocumentRoot "/home/www/tp5/public"
    ServerName tp5.com
</VirtualHost>

think命令

# 创建module
php think build --module demo

安装

composer create-project topthink/think  tp5  --prefer-dist

Lat Long conversion for import

Lat Long conversion for import into WP Google Map Pro plugin
<?php
	
	// quick and dirty csv long lat conversion script
	// converts lat / long in this format:
	// N34 58.840 W85 55.147
	// to decimal format for import into WP Google Map Pro plugin

	$csv = array_map('str_getcsv', file('caves.csv'));

	$new_csv = array();

	foreach($csv as $data){
		
		$long_lat_pair = $data[1];

		// break into long and lat
		$long_lat_pair_array = explode('W', $long_lat_pair);

		$long_lat_pair_array[0] = ltrim($long_lat_pair_array[0], 'N');

		$long_lat_pair_array[0] = trim($long_lat_pair_array[0]);
		$long_lat_pair_array[1] = trim($long_lat_pair_array[1]);

		$lat_array = explode(' ', $long_lat_pair_array[0]);
		$long_array = explode(' ', $long_lat_pair_array[1]);

		$lat = $lat_array[0];
		$lat_dec = $lat_array[1] / 60;
		$lat .= '.'.intval($lat_dec * 100000);

		$long = '-'.$long_array[0];
		$long_dec = $long_array[1] / 60;
		$long .= '.'.intval($long_dec * 100000);

		$new_data = array();
		$new_data['name'] = $data[0];
		$new_data['address'] = ' '; // needed, even if blank, for plugin import
		$new_data['lat'] = $lat;
		$new_data['long'] = $long;

		$description = '';

		if(!empty($data[3])){
			$description .= 'Cave Altitude: '.$data[3].'ft<br>';
		}

		$description .= '<a href="'.$data[2].'" target="blank">View in Google Maps</a>';

		$new_data['description'] = $description;

		$new_csv[] = $new_data;


	}// foreach

	$new_csv_file = fopen("new_caves.csv",'w') or die("Can't open php://output");

	fputcsv($new_csv_file, array('name','lat','long', 'desc'));
	
	foreach($new_csv as $value) {
		fputcsv($new_csv_file, $value);
	}

	fclose($new_csv_file) or die("Can't close php://output");

	echo 'done';

Serialize levels

/// <summary> /// The level manager component class /// </summary>
/// <summary>
/// The level manager component class
/// </summary>
public class LevelManager : MonoBehaviour
{
    [SerializeField]
    private List<Level> levels;
    [SerializeField]
    private Level currentLevel;
}
 
[Serializable]
public class Level
{
    public string sceneName;
    public float points;
    public bool finishedLevel;
}