Skip to content

Instantly share code, notes, and snippets.

@sirkkalap
sirkkalap / .inputrc
Created May 11, 2017 17:24
.inputrc with history search
### .inputrc
## arrow up
"\e[A":history-search-backward
## arrow down
"\e[B":history-search-forward
#!/bin/sh -e
# Running this script will disable the on-access (real-time) scanner in F-Secure Anti-Virus for Mac
# while preserving the ability to use the on-demand (manual) scanner.
#
# Note that this *will* make the UI persistently tell you that there is a problem with real-time
# scanning. Which is true, because you disabled it. :-)
#
# NOTE THAT THIS WILL MAKE YOUR COMPUTER UNPROTECTED. DO THIS AT YOUR OWN RISK!
# NOTE THAT THIS WILL MAKE A BACKUP COPY IN YOUR "Documents" FOLDER. KEEP IT.
# NOTE THAT THIS IS AN UNSUPPORTED HACK. IT MAY STOP WORKING AT ANY TIME.
@sirkkalap
sirkkalap / vim_centos.sh
Last active March 11, 2017 17:00 — forked from fundon/vim_centos.sh
install vim 7.3 on centos, debian, arch etc.
#!/bin/bash
# Install VIM with LUA support on centos minimal (tested 2016-01-21 on CentOS 7)
# source <(curl -sSL https://gist.githubusercontent.com/sirkkalap/1a9d954122039ab6f78f/raw/vim_centos.sh)
# bailout on errors
set -e
sudo yum -y groupinstall 'Development tools'
sudo yum -y install ncurses-devel
sudo yum -y install python python-devel
@sirkkalap
sirkkalap / hipchat
Created January 28, 2016 09:36
Open the company HipChat without "Chrome chrome"
#!/bin/sh
# OS X
chrome=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
if [ -e $chrome ]; then
$chrome --app=https://company.hipchat.com/chat/lobby
else
echo $chrome is required but not found.
fi
@sirkkalap
sirkkalap / nfs-mount-boot2docker.sh
Last active September 3, 2016 21:23
A script to switch boot2docker to use NFS instead of VBoxfs for speed and proper permissions
#!/bin/bash
############################################################################
# Note: Special network 192.162.50.3 to use Cisco Anyconnect Split tunnel.
#
# On OX X host you need to add a line (and file) /etc/exports:
# /Users -mapall=[youruser]:[yourgroup] [boot2dockerip]
# See: https://quip.com/EDYLAAfuup5M (no login needed)
# See also: https://github.com/boot2docker/boot2docker/issues/587#issuecomment-66935011
# See also: http://support.apple.com/en-us/HT202243
@sirkkalap
sirkkalap / InstallProxyTunnelUbuntu.sh
Last active August 18, 2016 08:07
This installs dependencies, checks out the Proxytunnel and builds it on Ubuntu.
# Use
# curl -sSL https://gist.githubusercontent.com/sirkkalap/3c11f952fea778110cfdb73ec3b97d8b/raw/InstallProxyTunnelUbuntu.sh | bash -x
sudo apt-get -y install libssl-dev
git clone https://github.com/sirkkalap/proxytunnel.git
cd proxytunnel
make proxytunnel
#!/bin/sh
# curl -sSL https://gist.githubusercontent.com/sirkkalap/f31998c57cc0c3b5fbd5b0b0ee7bbca2/raw/3665a4962caba46b2729e4b5b835503c98734ae2/git-lg.sh | sh -
git config --global alias.lg \
"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
@sirkkalap
sirkkalap / brew_update_upgrade.sh
Created March 17, 2016 15:56
Keep up to date with Homebrew
#!/bin/sh
BASEDIR=$(cd $(dirname $0); /bin/pwd)
($BASEDIR/isodate && /usr/local/bin/brew update && /usr/local/bin/brew upgrade --all) >>$HOME/brew-update.log 2>&
@sirkkalap
sirkkalap / test-dns.sh
Last active March 16, 2016 11:27
Sometimes DNS answers change unexpectedly. This shell script will try to log DNS answers. You may change the DNS-server IP addresses on lines 4 and 5.
#!/bin/bash
while true; do
echo $(date +%FT%T%z) $(dig +noall +answer +stats ftp.example.com | tr '\n' ' ')
echo $(date +%FT%T%z) $(nslookup ftp.example.com 10.1.2.3 | tr '\n' ' ')
echo $(date +%FT%T%z) $(nslookup ftp.example.com 10.2.4.6 | tr '\n' ' ')
sleep 60
done
#[sirkkalap@mymachine ~]$ nohup ./test_dns.sh &
#[1] 16406
#[sirkkalap@mymachine ~]$ tail nohup.out
@sirkkalap
sirkkalap / Find script base dir on most posix environments
Created January 25, 2016 18:56
BASEDIR allows running scripts without cd'ing into their folders first. With properly set basedir all local resources can be referenced without CWD being in the script folder.
#!/bin/sh
BASEDIR=$(cd "$(dirname "$0")"; pwd)
echo $BASEDIR