Skip to content

Instantly share code, notes, and snippets.

View epcim's full-sized avatar

Petr Michalec epcim

View GitHub Profile
@dayreiner
dayreiner / log-all-zsh-bash-commands-syslog.md
Last active August 1, 2024 04:59
Log all users zsh / bash commands via syslog without 3rd-party tools or auditd

Sending Bash and ZSH Commands to Syslog

Also posted here: http://18pct.com/sending-bash-and-zsh-commands-to-syslog/

Your bash/zsh history is great if its complete, but it doesn't capture commands across all users, sudo's, root commands etc. In particular with test environments, someone may perform a "one-off" procedure and then months later it needs to be repeated. It would be nice to be able to look up what the user did at the time, and searching through multiple, possibly truncated history files is a pain.

Tools like typescript are great if you're actively documenting, but not something you would use all the time in practice and capture more than just a history of your commands. There are third-party tools like rootsh and Snoopy that can accomplish this, but third-party tools can be overkill if all you want is a quick reference in a re

With Release 3.0, contrail-heat resources/templates are being auto-generated from the Schema.
The generated resources/templates are part of the python-contrail package and located in
/usr/lib/python2.7/dist-packages/vnc_api/gen/heat/ directory. This directory has three sub-directories
1. resources/
This sub-directory contains all the resources for the contrail-heat plugin. It runs in the context
of the heat-engine service.
2. templates/
This sub-directory contains template for each resource. They are sample templates with every possible
@robinsmidsrod
robinsmidsrod / sysrcd.ipxe
Last active February 19, 2025 09:06
SystemRescueCD iPXE menu script and monkeypatch for preloading sysrcd.dat with iPXE instead of loading from local storage
#!ipxe
set sysrcd-version 4.7.1
echo Booting SystemRescueCD ${sysrcd-version} x86 for ${initiator-iqn}
# Kernel command-line options are documented here:
# http://www.system-rescue-cd.org/Sysresccd-manual-en_Booting_the_CD-ROM#Network_boot_using_PXE
set base-url sysrcd-${sysrcd-version}-x86/
kernel ${base-url}isolinux/altker${archs} setkmap=no net.ifnames=0 backstore=off
initrd ${base-url}isolinux/initram.igz
initrd ${base-url}sysrcd.dat /sysrcd.dat
# Load the ramdisk again as a file inside the ramdisk, so our custom init script
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@kwilczynski
kwilczynski / disable-ipv6.sh
Last active March 28, 2025 22:42
Amazon Linux OS tweaks
#!/bin/bash
set -u
set -e
set -o pipefail
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
cat <<'EOF' > /etc/modprobe.d/blacklist-ipv6.conf
@jmshal
jmshal / create-multi-host-swarm-digitalocean.sh
Last active March 16, 2023 13:22
Setup a Docker Swarm multi-host cluster on DigitalOcean
docker-machine create \
--driver=digitalocean \
--digitalocean-access-token=$DO_TOKEN \
--digitalocean-size=512mb \
--digitalocean-region=nyc3 \
--digitalocean-private-networking=true \
--digitalocean-image=ubuntu-15-04-x64 \
docker-swarm-kv-store
docker $(docker-machine config docker-swarm-kv-store) run -d \
Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
Ctrl-F2 Create a vertical split
Ctrl-Shift-F2 Create a new session
#!/bin/zsh
#
## build kernel modules, if fail
cd /var/lib/dkms/vboxhost/`vboxmanage --version | sed 's/^\(......\).*/\1/'|tail -n 1`/build; sudo make KERNELRELEASE=`uname -r` -C /lib/modules/`uname -r`/build M=/var/lib/dkms/vboxhost/`vboxmanage --version | sed 's/^\(......\).*/\1/'|tail -n1`/build; for i in `find vbox* -name "*.ko"`;do sudo mkdir -p /lib/modules/`uname -r`/misc; sudo cp -v $i /lib/modules/`uname -r`/misc;sudo insmod /lib/modules/`uname -r`/misc/`basename $i`;done
K=`uname -r`
sudo rmmod vboxnetadp vboxnetflt vboxpci vboxdrv vmmon vmnet
for i in `ls /lib/modules/$K/misc/|xargs`; do
sudo insmod /lib/modules/$K/misc/$i;
done

Oh My Fish Plugins

ansible: Ansible development package for Oh My Fish

apt: Short and friendly command wrapper for APT

battery: OS X and Linux compatible battery utilities

brew: Oh My Fish plugin to integrate Homebrew paths into shell.