Skip to content

Instantly share code, notes, and snippets.

@gg7
gg7 / 01-upstart-normal.sh
Last active May 15, 2016 19:42
leaking orphaned processes
root@u1404:~# cat /etc/init/orph.conf
description "orphaned process / process group test"
respawn
script
sleep 9999 &
sleep 4444
end script
root@u1404:~# start orph
orph start/running, process 3269
@gg7
gg7 / container-ips.sh
Created March 10, 2016 02:16
Get all IP addresses of all Docker containers
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
docker inspect $(docker ps -q) \
| jq -c '.[] | {name: .["Name"], ips: .["NetworkSettings"]["Networks"] | map(.IPAddress)} | [.name, .ips]'
root@server:~# apt-get -y install linux-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
firefox-locale-en libmpdec2 linux-image-2.6.38-9-server
linux-image-3.2.0-60-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
linux-headers-generic linux-image-generic
@gg7
gg7 / cve-2015-7547.yml
Last active August 5, 2016 02:15
CVE-2015-7547 Ansible playbook
- hosts: all
remote_user: root
tasks:
- name: Apt-get update
apt: update_cache=yes cache_valid_time=3600
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Check if libc6 is installed (apt)
command: dpkg-query -W libc6
register: libc6
@gg7
gg7 / upgrade-docker-to-1.8.sh
Last active October 14, 2015 10:40 — forked from nsisodiya/docker.sh
Upgrade to Docker 1.8 on Ubuntu 14.04
#/bin/bash
set -o errexit
set -o nounset
set -o pipefail
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@gg7
gg7 / psql-ssh.sh
Last active January 28, 2016 23:18
Using psql with a SSH tunnel
#!/bin/bash
set -e
set -u
set -o pipefail
if [ $# -eq 0 ]; then
echo "Usage: $0 <host> [psql args]" 2>&1
exit 1
fi
#!/bin/sh
id=`wmctrl -v -r :SELECT: -e dummy 2>&1 | grep Using.window | grep -o 0x[0-9a-fA-F]*`
xdotool windowunmap $id
#!/bin/sh
sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -xb | \
vim -R -c 'set ft=man' \
-c 'let no_plugin_maps = 1' \
-c 'set nolist ft=man' \
-c 'let g:showmarks_enable=0' \
-c 'runtime! macros/myless.vim' -
@gg7
gg7 / hn-jellybeans-style.css
Last active August 29, 2015 14:00
https://i.imgur.com/kN6itL0.png -- My fork of "Jellybeans Hacker News (w/ unicode arrows)"
@-moz-document domain("news.ycombinator.com") {
* { font-family: sans-serif !important; }
body { margin: 0; font-size: 16pt !important; }
.title { font-size: 20pt !important; }
.pagetop, .comment, .comhead, .subtext, td, p,
.pagetop *, .comment *, .comhead *, .subtext * { font-size: 14pt !important; }
font { color:inherit !important; font-family:inherit !important; font-size:inherit !important; text-shadow: black 0px 1px 3px !important; }
@gg7
gg7 / make.conf
Created April 29, 2014 10:07
Default make.conf on Gentoo
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the