Skip to content

Instantly share code, notes, and snippets.

View g4mqjx's full-sized avatar

g4mqjx g4mqjx

View GitHub Profile
@g4mqjx
g4mqjx / docker-compose.yml
Created March 27, 2019 08:18 — forked from crackcomm/docker-compose.yml
NSQ docker-compose
nsqlookup:
image: nsqio/nsq
hostname: nsqlookup
ports:
- "4160:4160"
- "4161:4161"
command: /nsqlookupd
nsq:
@g4mqjx
g4mqjx / tmux-cheatsheet.markdown
Created September 20, 2018 09:12 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@g4mqjx
g4mqjx / git_toturial
Created September 20, 2018 09:12 — forked from guweigang/git_toturial
git命令大全
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "[email protected]" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://[email protected]/VT.git # clone远程仓库
@g4mqjx
g4mqjx / mysql-docker.sh
Created September 20, 2018 09:11 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@g4mqjx
g4mqjx / MySQL Replication Check
Created September 20, 2018 07:49 — forked from flickerfly/MySQL Replication Check
Just a simple Mysql Replication Health Check script I wrote. You can put this in a cron.
#!/bin/bash
### VARIABLES ### \
[email protected]
SERVER=$(hostname)
MYSQL_CHECK=$(mysql -e "SHOW VARIABLES LIKE '%version%';" || echo 1)
SLAVE_STATUS=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G"|grep -v row)
LAST_ERRNO=$(echo "${SLAVE_STATUS}" | grep "Last_Errno:" | awk '{ print $2 }' )
SECONDS_BEHIND_MASTER=$(echo "${SLAVE_STATUS}" | grep "Seconds_Behind_Master:" | awk '{ print $2 }' )
IO_IS_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Slave_IO_Running:" | awk '{ print $2 }' )
@g4mqjx
g4mqjx / httpserve.py
Created July 24, 2018 09:34 — forked from ThomasChiroux/httpserve.py
python2 and python3 compliant simple http server
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""launch small http server
"""
import sys
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError: