Skip to content

Instantly share code, notes, and snippets.

@jimyang2008
jimyang2008 / cf-api.sh
Last active December 19, 2023 11:41
cf-api.sh
#!/bin/bash
err() {
echo "ERROR: $@" >&2
}
cf_api() {
action=$1; shift
context=$1; shift
curl -Lks --request $action \
@jimyang2008
jimyang2008 / nodejs.md
Last active July 8, 2020 03:22
NodeJS study notes

Node JS characteristics

Functional programming

Asynchronous programming

Tasks can be executed asynchronously only if NO dependency.

With dependency, there will be a producer and a consumer. Consumer need to process result provided by producer.

@jimyang2008
jimyang2008 / working_experience.md
Last active March 19, 2020 12:29
Working Experience

Keep everybody on a same page

Maintain an up-to-date published document to make it clear to everybody. It helps to make things clear among different groups. It provides information visibility to everybody.

Writing down things rather than remember

Keep a record of daily activities, gained information, tips, etc. It helps to review and get things connected.

@jimyang2008
jimyang2008 / fix_ntfs.sh
Created March 22, 2019 07:09
Fix NTFS in Mac
#!/bin/bash
err() {
msg="$@"
echo "ERROR: $msg" >&2
}
[[ `id -u` == '0' ]] || {
err "must run as root or with sudo"
exit 1
@jimyang2008
jimyang2008 / download_ssl_cert.sh
Last active March 20, 2019 05:47
Download HTTP SSL certificates into JKS keystore
#!/bin/bash
set +e
CMD=${0##*/}
CMDDIR=$(cd ${0%/*}>/dev/null; pwd -P)
STOREPASS='changeit'
OPENSSL=openssl
@jimyang2008
jimyang2008 / install_python_pip_no_root.sh
Last active March 20, 2019 05:40
install Python 2.7 and Pip without root access
#!/bin/bash
INSTALL_DIR=~/opt/python
TMP_DIR=/tmp/install_python
mkdir -p $INSTALL_DIR
DIR_OPENSSL=openssl-1.0.2k
DIR_PYTHON=Python-2.7.13
FILE_OPENSSL=${DIR_OPENSSL}.tar.gz
FILE_PYTHON=${DIR_PYTHON}.tgz
@jimyang2008
jimyang2008 / install_tmux.sh
Created March 20, 2019 05:36
install tmux script
#!/bin/bash
set -e
FTP_BASE='ftp://ftp.yangjian.net/pub'
LIBEVENT=libevent-2.1.8-stable
NCURSES=ncurses
TMUX=tmux-2.6
OPT_DIR=$HOME/opt
@jimyang2008
jimyang2008 / install-python27-centos67.md
Created February 25, 2019 04:13
Install Python 2.7 on CentOS 6/7
curl -LOk https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
tar -zf Python-2.7.15.tgz
cd Python.2.7.15
./configure --enable-optimization
make altinstall
curl -LOk https://bootstrap.pypa.io/get-pip.py
python2.7 get-pip.py
@jimyang2008
jimyang2008 / tcpdump.md
Last active April 15, 2019 03:12
TCPDUMP reference

Overview

tcpdump

  • Is a packet content inspection tool
  • Does packet filtering by boolean expression

For expression syntax, refere to pcap-filter(7)

Syntax

@jimyang2008
jimyang2008 / owncloud_install.sh
Last active May 10, 2018 12:00
install ownCloud in Linux
#!/bin/bash
set -e
err() {
echo "$@" >&2
}
prepare_redhat() {
yum update -y