Skip to content

Instantly share code, notes, and snippets.

@abelboldu
abelboldu / java.env
Created November 7, 2012 15:11 — forked from dln/java.env
Zookeeper RPM spec for CentOS 5.x, including python bindings
ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
ZOO_LOG_DIR="/var/log/zookeeper/"
@abelboldu
abelboldu / w32-busybox
Created March 7, 2013 14:43
Install busybox on windows HyperV core from a PowerShell cmd
$client = new-object System.Net.WebClient
$client.DownloadFile( "http://dl.dropbox.com/u/5943991/busybox-w32/busybox.exe", "C:/windows/busybox.exe" )
.\busybox.exe --help
@abelboldu
abelboldu / wincore-cygwin
Created March 7, 2013 15:43
install cygwin in HyperV/windows server core from powershell cmd to enable sshd
echo Enabling firewall rule...
netsh advfirewall firewall add rule name="SSHd" dir=in action=allow protocol=TCP localport=22
echo Downloading cygwin installer...
$client = new-object System.Net.WebClient
$client.DownloadFile( "http://www.cygwin.com/setup.exe", "c:\windows\temp\setup.exe" )
.\Windows\Temp\setup.exe
@abelboldu
abelboldu / libvirt100-allhv
Last active December 15, 2015 10:29
Hypervisor agnostic libvirt in Ubuntu 12.04
sudo apt-get install libyajl-dev libopenwsman-dev gcc make pkg-config \
libxml2-dev libgnutls-dev libdevmapper-dev libcurl4-openssl-dev python-dev \
libxen-dev
wget http://libvirt.org/sources/libvirt-1.0.0.tar.gz
tar xvzf libvirt-1.0.0.tar.gz
cd libvirt-1.0.0
./configure --prefix=/usr --localstatedir=/var \
--sysconfdir=/etc --with-esx=yes --with-hyperv=yes --with-xen=yes
make
sudo make install
@abelboldu
abelboldu / g_in_the_shell
Created March 27, 2013 13:16
Useful cummands puked here
# Monitoring processes I/O
dstat -s --top-io --top-bio
iotop
@abelboldu
abelboldu / commands_pit
Last active November 22, 2016 22:54
Useful/fun/weird commands
#Find a (wired) Raspberry Pi on the network
nmap -sn 192.168.1.0/24 > /dev/null; cat /proc/net/arp | grep b8:27 | awk '{print $1}'
# Symmetric encrypt with Blowfish
openssl enc -bf-cbc -salt -in myfile.txt -out myfile.enc
# Symmetric decrypt with Blowfish
openssl enc -d -bf-cbc -in myfile.enc -out myfile.txt
# Almost invisible shell
ssh -o UserKnownHostsFile=/dev/null -T user@host /bin/bash -i
@abelboldu
abelboldu / rhelance
Last active August 29, 2015 14:06
Must add for basic RHEL/CentOS6 machines
#!/bin/bash
# run as root
yum install -y vim git tcpdump yum-utils wget w3m strace lsof curl sudo screen
yum localinstall -y http://ftp.cica.es/epel/6/i386/epel-release-6-8.noarch.rpm
yum install -y bash-completion htop ccze mtr nmap tmux
@abelboldu
abelboldu / leopold_kb.sh
Created February 24, 2015 09:15
Leopold FC660C custom layout
setxkbmap -layout us -variant altgr-intl -option -option lv3:ralt_switch
xmodmap -e "keycode 47 = semicolon colon semicolon colon dead_grave dead_grave"
@abelboldu
abelboldu / delete_vm_from_db.sh
Last active August 29, 2015 14:19
Delete instance in nova
# The usage quotas for the tenant are updated after deleting or creating a new instance
read -s -p "MySQL Password: " pw
vm_uuid=$1
mysql -D nova -p$pw -e "update instances set deleted='1', vm_state='deleted',deleted_at='now()' where uuid='$vm_uuid' limit 1;"
sleep 1
mysql -D nova -p$pw -e "delete from instance_faults where instance_faults.instance_uuid = '$vm_uuid';"
mysql -D nova -p$pw -e "delete from instance_id_mappings where instance_id_mappings.uuid = '$vm_uuid';"
mysql -D nova -p$pw -e "delete from instance_info_caches where instance_info_caches.instance_uuid = '$vm_uuid';"
mysql -D nova -p$pw -e "delete from instance_system_metadata where instance_system_metadata.instance_uuid = '$vm_uuid';"
mysql -D nova -p$pw -e "delete from security_group_instance_association where security_group_instance_association.instance_uuid = '$vm_uuid';"
@abelboldu
abelboldu / ost_oneliners
Last active August 29, 2015 14:22
OpenStack OneLiners
# Clean all unassociated FIPs
nova floating-ip-list | grep "| -" | awk '{ print $2}' | xargs -L1 nova floating-ip-delete