Skip to content

Instantly share code, notes, and snippets.

Alfred Zhou adaiguoguo

Block or report user

Report or block adaiguoguo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adaiguoguo
adaiguoguo / 20T+ mount
Last active Dec 12, 2017
how to mount 20T+
View 20T+ mount
# yum install -y parted
# parted /dev/vdd
GNU Parted 3.1
Using /dev/vdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
(parted) unit TB
(parted) mkpart primary 0.00TB 21.5TB
(parted)print
Model: Virtio Block Device (virtblk)
@adaiguoguo
adaiguoguo / playbook.yml
Created Sep 20, 2017
ansible-upgrade-kernel
View playbook.yml
- name: Check for reboot hint.
shell: LAST_KERNEL=$(rpm -q --last kernel | perl -pe 's/^kernel-(\S+).*/$1/' | head -1);CURRENT_KERNEL=$(uname -r); if [ $LAST_KERNEL != $CURRENT_KERNEL ]; then echo 'reboot'; else echo 'no'; fi
ignore_errors: true
register: reboot_hint
- name: Rebooting ...
shell: sleep 2 && /usr/sbin/reboot
async: 1
poll: 0
ignore_errors: true
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View gist:3082c665ff44255c9af8dad1858c3606
2017-06-05 21:59:03.311 info docker[3635137]: time="2017-06-05T21:59:03.308835132+08:00" level=info msg="stopping containerd after receiving terminated"
2017-06-05 21:59:03.311 info docker[3635137]: time="2017-06-05T21:59:03.310181591+08:00" level=info msg="Processing signal 'terminated'"
2017-06-05 21:59:03.340 info docker[3635137]: time="2017-06-05T21:59:03.340860149+08:00" level=error msg="libcontainerd: failed to receive event from containerd: rpc error: code = 13 desc = transport is closing"
2017-06-05 21:59:03.781 info docker[3635137]: time="2017-06-05T21:59:03.781057627+08:00" level=info msg="libcontainerd: new containerd process, pid: 1318805"
2017-06-05 21:59:04.876 info docker[3635137]: time="2017-06-05T21:59:04.876015296+08:00" level=error msg="containerd: notify OOM events" error="no init process found"
2017-06-05 21:59:05.066 info docker[3635137]: time="2017-06-05T21:59:05.066695144+08:00" level=info msg="libcontainerd: new containerd process, pid: 1319032"
2017-06-05 21:59:06.351 info docker[363
@adaiguoguo
adaiguoguo / diff
Created Mar 21, 2017
gitlab CVE-2017-0882
View diff
[root@vpct-gitlab-1 gitlab-rails]# diff app/controllers/projects/issues_controller.rb /tmp/issues_controller.rb
115c115
< render json: @issue.to_json(include: { milestone: {}, assignee: { only: [:name, :username], methods: [:avatar_url] }, labels: { methods: :text_color } })
---
> render json: @issue.to_json(include: { milestone: {}, assignee: { methods: :avatar_url }, labels: { methods: :text_color } })
[root@vpct-gitlab-1 gitlab-rails]# diff app/controllers/projects/merge_requests_controller.rb /tmp/merge_requests_controller.rb
281c281
< render json: @merge_request.to_json(include: { milestone: {}, assignee: { only: [:name, :username], methods: [:avatar_url] }, labels: { methods: :text_color } })
---
> render json: @merge_request.to_json(include: { milestone: {}, assignee: { methods: :avatar_url }, labels: { methods: :text_color } })
@adaiguoguo
adaiguoguo / goroutine-stacks-2017-03-09T214055+0800.log
Created Mar 9, 2017
var/run/docker/goroutine-stacks-2017-03-09T214055+0800.log
View goroutine-stacks-2017-03-09T214055+0800.log
goroutine 218 [running]:
github.com/docker/docker/pkg/signal.DumpStacks(0x18f6c6a, 0xf, 0x0, 0x0, 0x0, 0x0)
/root/rpmbuild/BUILD/docker-engine/.gopath/src/github.com/docker/docker/pkg/signal/trap.go:82 +0xfc
github.com/docker/docker/daemon.(*Daemon).setupDumpStackTrap.func1(0xc420b17da0, 0x18f6c6a, 0xf, 0xc420358200)
/root/rpmbuild/BUILD/docker-engine/.gopath/src/github.com/docker/docker/daemon/debugtrap_unix.go:19 +0xcb
created by github.com/docker/docker/daemon.(*Daemon).setupDumpStackTrap
/root/rpmbuild/BUILD/docker-engine/.gopath/src/github.com/docker/docker/daemon/debugtrap_unix.go:32 +0x10a
goroutine 1 [chan receive, 23656 minutes]:
main.(*DaemonCli).start(0xc42052ade0, 0x0, 0x1908125, 0x17, 0xc420087400, 0xc42050c2d0, 0xc42044e6c0, 0x0, 0x0)
@adaiguoguo
adaiguoguo / power_check.sh
Last active Sep 6, 2016
检查宿主是否有cpu时钟休眠
View power_check.sh
#!/bin/bash
#
pro=$(dmidecode -t 1|grep Manufacturer|awk '{print $2}')
sys=$(lsb_release -a|grep ID |awk '{print $3}')
ver=$(lsb_release -a|grep Release|awk '{print $2}'|awk -F '.' '{print $1}')
if [[ $pro == Dell ]]
then
if [[ $sys == "CentOS" ]]
then
@adaiguoguo
adaiguoguo / lvremove.sh
Created Jul 20, 2016
老机器上lvremove
View lvremove.sh
#!/bin/sh
lvremove /dev/vol_vdb1/lvol0
lvremove /dev/vol_vdb1/lvol1
lvremove /dev/vol_vdb1/lvol2
pvremove /dev/vdb1 --force --force
fdisk -c -u /dev/vdb <<EOF
D
w
EOF
@adaiguoguo
adaiguoguo / extract.sh
Last active Jun 8, 2016 — forked from liaoyw/extract.sh
解压小能手
View extract.sh
# copy from http://www.tldp.org/LDP/abs/html/sample-bashrc.html
function extract() # Handy Extract Program
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
@adaiguoguo
adaiguoguo / postgres.sql
Created Nov 5, 2015
postgres count gitlab pr &push
View postgres.sql
SELECT aa.datetime,
aa.cc pushed,
bb.cc pr
FROM (SELECT To_char(created_at, 'YYYY-MM-DD') datetime,
Count (1) cc
FROM EVENTS
WHERE action = 5
AND created_at > NOW() - '30 DAY'::INTERVAL
GROUP BY To_char(created_at, 'YYYY-MM-DD'),
target_type,
You can’t perform that action at this time.