Skip to content

Instantly share code, notes, and snippets.

View poojan's full-sized avatar

Poojan Shrestha poojan

View GitHub Profile
@poojan
poojan / upsert.js
Created August 24, 2016 14:47 — forked from plurch/upsert.js
PostgreSQL 9.5 Upsert using Knex.js
exports.knex = require('knex')({
client: 'pg',
connection: {
host : '127.0.0.1',
user : 'your_database_user',
password : 'your_database_password',
database : 'myapp_test'
}
});
@poojan
poojan / reddit.js
Last active January 6, 2016 06:35
Browsing reddit from developer console
// Usage:
// Copy paste the script to Developer Console. Then:
// reddit('https://www.reddit.com/top')
// reddit('https://www.reddit.com/new.json')
// reddit('https://www.reddit.com/r/radiohead/top')
// reddit('https://www.reddit.com/r/radiohead/top.json')
// reddit('https://www.reddit.com/r/radiohead.json')
// reddit('https://www.reddit.com/r/radiohead')
// ... etc.
@poojan
poojan / GistList!.md
Created October 7, 2014 00:10
Try GistList for iOS! http://gistlist.io/

##alt text GistList: TODO for coders alt text

[
{
"className": ".Canada",
"country": "Canada",
"data": [
{
"x": 1994,
"y": 13
},
{
@poojan
poojan / focus
Created April 24, 2014 00:40
Focus script for hotkeys
#!/bin/bash
#http://askubuntu.com/questions/269574/wmctrl-focus-most-recent-window-of-an-app
app_name=$1
workspace_number=`wmctrl -d | grep '\*' | cut -d' ' -f 1`
win_list=`wmctrl -lx | grep $app_name | grep " $workspace_number " | awk '{print $1}'`
active_win_id=`xprop -root | grep '^_NET_ACTIVE_W' | awk -F'# 0x' '{print $2}' | awk -F', ' '{print $1}'`
if [ "$active_win_id" == "0" ]; then