Skip to content

Instantly share code, notes, and snippets.

@metrofx
metrofx / hosts
Created November 4, 2018 02:58
Unblock Reddit in Indonesia: use these DNS records if you don't want to use VPN
151.101.193.140 reddit.com
151.101.65.140 reddit.com
151.101.1.140 reddit.com
151.101.129.140 reddit.com
151.101.193.140 www.reddit.com
151.101.65.140 www.reddit.com
151.101.1.140 www.reddit.com
151.101.129.140 www.reddit.com
151.101.193.140 www.redditstatic.com
151.101.65.140 www.redditstatic.com
0x0e6cDa245501Ed219D29234c7082197F7b7B0966
@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)\"
@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 / 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 / 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 / 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 / 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 / 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 / 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" \