Skip to content

Instantly share code, notes, and snippets.

@metrofx
metrofx / glog
Created February 12, 2014 07:56
Pretty git log, displays 20 last commits.
#!/bin/sh
git --no-pager log -n 20 --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
@metrofx
metrofx / check-http-resp-code.sh
Created March 6, 2014 10:33
I'm tired of waiting for DNS Propagation, so I created this script and put it in crontab. Then I leave my desk for pingpong session...
#!/bin/bash
TOKEN=<your Pushover token>
USER=<generated by Pushover>
MSG="Udah up nih bro!"
URL="url-you-need-to-check"
out=$(curl --write-out "%{http_code}\n" --silent --output /dev/null $URL)
if [ $out = '200' ] ; then
curl -s \
-F "token=$TOKEN" \
-F "user=$USER" \
@metrofx
metrofx / hubot
Created April 13, 2014 16:21
Hubot custom launcher, using forever (https://github.com/nodejitsu/forever). Useful if you host Hubot in your own server.
#!/bin/sh
# Location: bin/hubot
# Hubot custom launcher, using forever (https://github.com/nodejitsu/forever).
# If you want to run hubot locally, don't call this script. run this instead:
# coffee node_modules/.bin/hubot
npm install
# put below path into hubot.env along with other hubot environment variables
# export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH"
@metrofx
metrofx / build-auto-adduser-script.sh
Last active August 29, 2015 14:00
Bulk-create linux users with auto-generated password.
#!/bin/bash
for userlist in `cat userlist.txt`
do
user=`echo $userlist | cut -f 1 -d ,`
pwd=`echo $userlist | cut -f 2 -d ,`
echo "useradd -m -s /bin/bash $user && echo $user:$pwd | chpasswd"
done
@metrofx
metrofx / pagespeed.sh
Created March 16, 2015 05:55
Measure web page load speed using curl
#!/bin/bash
CURL="/usr/bin/curl"
GAWK="/usr/bin/awk"
URL="$1"
result=`$CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $URL`
echo "Host: $URL"
echo "Time_Connect Time_start_Transfer Time_total
$(echo $result | $GAWK -F: '{ print $1" "$2" "$3}')
" | column -t
@metrofx
metrofx / ElasticSearch.sh
Last active August 29, 2015 14:22 — forked from ricardo-rossi/ElasticSearch.sh
ElasticSearch install script for Ubuntu
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
@metrofx
metrofx / remove-xl-ads-from-your-site
Created February 2, 2016 10:11
Remove XL iframe ads from your site
<script type='text/javascript'>
if (!(parent && parent.WebPlayer) && top != self) {
top.location.replace(document.location);
alert('Untuk alasan keamanan, framing tidak diijinkan; klik OK untuk menghilangkan frame.');
}
</script>
@metrofx
metrofx / keybase.md
Last active November 30, 2018 08:25

Keybase proof

I hereby claim:

  • I am metrofx on github.
  • I am metrofx (https://keybase.io/metrofx) on keybase.
  • I have a public key ASAJqzN2Z6glhe7rQcTe4d6PWHNe0i2BkNhneN1jYKNexgo

To claim this, I am signing this object:

@metrofx
metrofx / random-commit.gitconfig
Last active August 1, 2017 04:06
Commit with random message
[user]
name = <yourname>
email = <youremail>
[core]
editor = vim
[push]
default = current
[alias]
wtc = !git commit -m \"$(curl -s whatthecommit.com/index.txt)\"
0x0e6cDa245501Ed219D29234c7082197F7b7B0966