Skip to content

Instantly share code, notes, and snippets.

@virullius
virullius / base-conversions.sh
Created October 30, 2014 15:49
Baes and ASCII conversion in bash. (hex, decimal, binary)
echo "syntax for base conversion in bash is: \$((\$BASE#\$VALUE))"
echo
echo "Decimal value of Hexadecimal 2B: \$((16#2B))"
echo $((16#2B))
echo
echo "Decimal value of binary 0110: \$((2#0110))"
echo $((2#0110))
echo
@virullius
virullius / gist:5b2c66983dc2665df7a8
Created December 3, 2014 18:23
highlight matched text, linux shell
# trick is to match on a non-printing character (^ is beginning of line) OR your pattern.
# this way all lines match but only your pattern containing printable characters will be highlighted
# using ^ requires Extended-Regexp option (-E)
grep -E '^|pattern' file.log
@virullius
virullius / gist:870fbad498cd74e954f4
Created December 4, 2014 18:03
Refresh user's groups - linux
exec su -l $USER
@virullius
virullius / Office2010Pro-Mint17.md
Last active September 9, 2015 21:07
Install MS Office Pro 2010 on Linux Mint 17 (Ubuntu 14.04) (wine 1.6.2)

Install MS Office 2010 Pro 32 bit on LinuxMint 17 (Ubuntu 14.04)

install prerequisite winbind

sudo apt-get install winbind

create prefix

WINEPREFIX=/home/<username>/.wine-<myprefix> WINEARCH=win32 wine 'wineboot'
@virullius
virullius / gist:e7873a169d360aa2b06a
Created December 16, 2014 00:27
check if nginx is running without killall
kill -0 $(ps -eo pid,command | grep nginx | grep master | awk -F ' ' '{print $1}')
@virullius
virullius / gist:77269e40faec18c0a875
Created January 6, 2015 15:41
be nice while taking backup of production webapp on linux during business hours
# default nice value seems fine in my case; ionice has no default, using class 3 for idle IO time
ionice -c 3 nice tar ~/the-webapp-20150106.tgz /opt/the-webapp
@virullius
virullius / other-dns-names
Created January 8, 2015 17:30
lookup other host names for a given hostname - via PTR records
host $(host $THE_DNSNAME | awk -F ' ' '{print $4}')
@virullius
virullius / gist:0814f91784a519d77ec8
Created January 8, 2015 18:08
run local script on remote server over ssh (bash)
ssh user@host 'bash -s' < /path/to/my-script.sh
@virullius
virullius / gist:ecbba5b6c6c82f241e7f
Last active August 29, 2015 14:13
simple clean list of network interfaces and IP (v4) addresses - linux, bash
ip addr show | grep 'inet ' | grep -v -E 'lo$' | awk -F ' ' '{print $NF, "\t", $2}'
# view MBR with partition table
sudo dd if=/dev/sda bs=512 count=1 | hexdump -C
# backup MBR without partition table
sudo dd if=/dev/sda of=mbr.backup bs=446 count=1