Skip to content

Instantly share code, notes, and snippets.

@adaiguoguo
adaiguoguo / 20T+ mount
Last active December 12, 2017 07:49
how to mount 20T+
# 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 September 20, 2017 15:24
ansible-upgrade-kernel
- 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
@adaiguoguo
adaiguoguo / tmux-cheatsheet.markdown
Created September 1, 2017 06:26 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
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 March 21, 2017 07:10
gitlab CVE-2017-0882
[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 March 9, 2017 13:51
var/run/docker/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 September 6, 2016 02:29
检查宿主是否有cpu时钟休眠
#!/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 July 20, 2016 03:22
老机器上lvremove
#!/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 June 8, 2016 03:07 — forked from liaoyw/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 November 5, 2015 03:40
postgres count gitlab pr &push
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,