Skip to content

Instantly share code, notes, and snippets.

View holysoros's full-sized avatar

LiJunjie holysoros

View GitHub Profile
@holysoros
holysoros / vim-go-install-binaries.sh
Last active August 7, 2022 04:03
Execute vim-go GoInstallBinaries command with proxy
env http_proxy=socks5://127.0.0.1:1081 https_proxy=socks5://127.0.0.1:1081 vim -c 'GoInstallBinaries' -c qa
@holysoros
holysoros / sushi.sh
Created March 22, 2019 08:24
A linux daemon init script
#!/bin/sh
set -e
DEPLOY_DIR="$( cd "$( dirname $0 )" && pwd )"
NAME=sushi
PIDFILE=${DEPLOY_DIR}/tmp/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=${DEPLOY_DIR}/${NAME}
@holysoros
holysoros / split.sh
Created March 22, 2019 08:21
Split data file into train and valid part.
#!/usr/bin/env bash
shuf $1 >random.txt
linenum=`wc -l random.txt | awk '{print $1}'`
validnum=$(($linenum/10))
trainnum=$(($validnum*9))
head -n $trainnum random.txt > notes.train
head -n $validnum random.txt > notes.valid
rm random.txt
@holysoros
holysoros / elasticsearch-rolling-restart.yml
Last active November 27, 2018 15:10
Elasticsearch rolling restart ansible playbook
# Ansible
# Rolling Upgrade of Elasticsearch
# author: Jeff Steinmetz, @jeffsteinmetz; Bin Li, @holysoros
# tested with Ansible 2.4
---
- name: Elasticsearch rolling upgrade
hosts: es
serial: 1
mysql> EXPLAIN SELECT slug FROM products WHERE deleted_at IS NULL AND id IN (36215, 10736, 40594, 14078, 40466, 1566, 4455, 6746, 41690, 3448,
39094, 13363, 15491, 10913, 4291, 41940, 40392, 10013, 33510, 6962);
+----+-------------+----------+------------+-------+--------------------------+---------+---------+------+------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+----------+------------+-------+--------------------------+---------+---------+------+------+----------+-------------+
| 1 | SIMPLE | products | NULL | range | PRIMARY,index_deleted_at | PRIMARY | 4 | NULL | 20 | 10.00 | Using where |
+----+-------------+----------+------------+-------+--------------------------+---------+---------+------+------+----------+-------------+
mysql> EXPLAIN SELECT slug FROM product
@holysoros
holysoros / tmux-cheatsheet.markdown
Last active September 12, 2016 04:56 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname