Skip to content

Instantly share code, notes, and snippets.

unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Shift arrow to resize pane
bind -n S-Down resize-pane -D 5
bind -n S-Up resize-pane -U 5
bind -n S-Left resize-pane -L 5
bind -n S-Right resize-pane -R 5
set nocompatible
set number
set mouse=a
" gitgutter 更新時間縮短
set updatetime=200
set backspace=2
set expandtab
set tabstop=4
set shiftwidth=4
set nu
@JackyYin
JackyYin / docker-compose.yml
Last active September 6, 2018 04:53
docker compose setting for nginx proxy
version: '3.5'
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
@JackyYin
JackyYin / docker-clean.sh
Last active April 10, 2019 03:59
檢查硬碟空間, 並清除prometheus docker volume
#!/bin/bash
usage()
{
echo ""
echo "Usage: $0 [ -d ][ -p ] "
echo -e "\t-d desired docker disk path"
echo -e "\t-p desired project path"
}
@JackyYin
JackyYin / object.js
Created June 26, 2019 05:47
測試javascript複製object的行為
// ref:
// https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
// https://medium.com/@jobboy0101/js%E5%9F%BA%E7%A4%8E-primitive-type-v-s-object-types-f88f7c16f225
let a = {
pro1: 'aaa',
pro2: {
pro22: 'aaaa'
}
};
@JackyYin
JackyYin / fibonacci.js
Created July 10, 2019 06:44
recursion v.s. iteration
const recursion = n => {
if (n === 0) return 0;
if (n === 1) return 1;
return recursion(n - 1) + recursion(n - 2);
};
const iteration = n => {
if (n === 0) return 0;
if (n === 1) return 1;
@JackyYin
JackyYin / gb.sh
Created July 22, 2019 00:58
parse my git branch
#!/bin/sh
parse_git_branch() {
git branch -a | sed -e "/^[^*]/d" -e "s/* \(.*\)/ $(echo '\033[1;31m')\1/"
}
echo $(parse_git_branch)
@JackyYin
JackyYin / ldap.js
Created July 22, 2019 01:06
a node.js ldap service use IIFE implementation
const ldapjs = require('ldapjs');
const url = process.env.LDAP_URL;
const LDAP_BIND_DN = process.env.LDAP_BIND_DN;
const LDAP_BIND_PWD = process.env.LDAP_BIND_PWD;
const SEARCH_DN = process.env.SEARCH_DN;
module.exports = (() => {
let client;
@JackyYin
JackyYin / sequential-promise.js
Last active August 2, 2019 01:26
Imagine we have an array of 10000 promises, how do we process them one by one ?
// Imagine we have an array of 10000 promises,
// How do we process them one by one ?
// Here is a general version g and a recursive version r
let input = [];
for (let i = 1; i <= 10000; i++) {
input.push(Promise.resolve(i));
}