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
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 } })
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)
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
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
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 ;;
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,
View lvmdisk.sh
umount /dev/vdb1 /data
fdisk -c -u /dev/vdb <<EOF
D
w
EOF
sleep 1s
fdisk -c -u /dev/vdb <<EOF
n
p
1