Skip to content

Instantly share code, notes, and snippets.

View thameera's full-sized avatar

Thameera Senanayaka thameera

View GitHub Profile
@thameera
thameera / twitternag.user.js
Created April 23, 2014 03:25
Removes the nagging 'try teh new profile' banner. For Chrome, go to Tools-> Extensions and drag this file to it.
// ==UserScript==
// @name fuck you twitter
// @namespace http://thameera.com
// @description Removes the nagging 'try the new profile' banner
// @include *://twitter.com/*
// @version 0.1
// ==/UserScript==
(function() {
document.getElementsByClassName('BannersContainer')[0].style.display = 'none';
@thameera
thameera / json.js
Created May 26, 2014 04:05
Simple JSON parse/stringify
var JSON = {
// implement JSON.stringify serialization
stringify : function(obj) {
var t = typeof (obj);
if (t != "object" || obj === null) {
// simple data type
if (t == "string")
obj = '"' + obj + '"';
@thameera
thameera / cvimrc
Last active August 29, 2015 14:03
vimrc for cvim
let blacklists = ["https://mail.google.com/*", "https://inbox.google.com/*", "https://trello.com/*", "http://www.codewars.com/*", "http://typing.lk/"]
set nosmoothscroll
@thameera
thameera / timer
Last active December 15, 2015 07:59
Small bash script I use to create timers from the terminal. Place it in your $PATH. When the alarm goes, a message is printed on terminal, a beep sound is played, a native notification is displayed and a message box pops up.
#!/bin/bash
# USAGE
# timer <time> <optional message>
# timer 15 You've lived enough. Go die!
echo "Will go off in" $1 "minutes..."
sleep $(($1*60))
shift
echo "Time's up!"
@thameera
thameera / .ttytterrc
Created March 30, 2013 11:30
My primary .ttytterrc file. Filtered screen names have been removed.
# colors
ansi=1
# use streaming API
dostream=1
# use ssl
ssl=1
# prompt before sending tweet
@thameera
thameera / tpbsort.user.js
Last active December 15, 2015 15:28
User script to automatically sort search results in The Pirate Bay (http://thepiratebay.*) by seeders count.
// ==UserScript==
// @name The Pirate Bay Seeder Sort
// @namespace http://thameera.com
// @description Sorts the Pirate Bay results by seeder count
// @include *://thepiratebay.*/*/99/*
// @version 0.1
// ==/UserScript==
(function() {
document.location.pathname = document.location.pathname.replace(/99/, '7');
@thameera
thameera / mbb
Created October 8, 2013 17:12
Connect to mobile broadband via terminal
#!/bin/bash
# Source: http://aithinking.wordpress.com/2012/06/13/startingstopping-mobile-broadband-services-in-linux/
# To get the connection name (id) and connection uuid, execute the following command
# nmcli -p con
# Replace defaultConnection and defaultConnectionsUUID with your own settings
defaultConnection="Dialog GSM Postpaid"
@thameera
thameera / pkill
Created October 15, 2013 06:08
pkill script
#!/bin/sh
# pkill
# be VERY careful with parameter $1
case $1 in
'' )
cat "$0"
;;
* )
for pid in $( ps -aW | grep -i $1 | awk '{ print $4 }' );
@thameera
thameera / countdown
Last active December 26, 2015 23:58
countdown script
#!/bin/bash
# USAGE
# ./countdown <num of seconds> <msg>
# eg:
# ./countdown 300 Time to rock!
date1=$((`date +%s` + $1));
shift
@thameera
thameera / tweet-linkify.js
Last active December 28, 2015 12:39 — forked from ghostrocket/tweet-linkify.js
Linkify the text of a tweet
var linkify_tweet = function(tweet) {
tweet = tweet.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,"<a href='$1'>$1</a>");
tweet = tweet.replace(/(^|\s|\.)@(\w+)/g, "$1<a href=\"http://www.twitter.com/$2\">@$2</a>");
return tweet.replace(/(^|\s)#(\w+)/g, "$1<a href=\"http://search.twitter.com/search?q=%23$2\">#$2</a>");
};