Skip to content

Instantly share code, notes, and snippets.


Amar Prabhu AmarPrabhu

View GitHub Profile
View exportjson.js
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
AmarPrabhu / ghost.conf
Created Feb 12, 2016
ghost upstart service
View ghost.conf
description "Ghost Blog"
author "Your Name"
# Start the service after everything loaded
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
# Automatically restart service
respawn limit 99 5
AmarPrabhu /
Created Jul 29, 2015
Split files according to .cue file
#taken from:
#install the essential packages
sudo apt-get install cuetools shntool flac
#shnsplit is the program used to split tracks,
#while cuebreakpoints it reads the break-points from file.cue and pipe them to shnsplit.
cuebreakpoints file.cue | shnsplit -o flac file.flac
View bootstrap.js
module.exports.bootstrap = function (cb) {
// Ensure we have 2dsphere index on Property so GeoSpatial queries can work!
sails.models.YOURMODEL.native(function (err, collection) {
collection.ensureIndex({ coordinates: '2dsphere' }, function () {
// It's very important to trigger this callack method when you are finished
// with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap)
View using-raw-socket-io-in-sails.js
module.exports = {
* Using raw functionality from a Sails.js controller
index: function (req,res) {
View interval.js
function interval(duration, fn){
this.baseline = undefined = function(){
if(this.baseline === undefined){
this.baseline = new Date().getTime()
var end = new Date().getTime()
this.baseline += duration
AmarPrabhu /
Created May 26, 2014
Install ttf fonts like fontawesome for Ubuntu
sudo mkdir fonts
sudo cp /usr/local/share/fonts/truetype/ fonts
cd /usr/local/share/fonts/truetype/
sudo chown root fonts/
AmarPrabhu /
Created May 10, 2014
Fix for brightness adjustment in Intel chipset based laptops - Xubuntu 14.04
sudo vim /etc/default/grub
# add the below line
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"
sudo halt
AmarPrabhu /
Created May 5, 2014
Git credential cache - remember password
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=36000'
#here it caches the password for 10Hrs (time in secs)
def poorMansConvert(di, inPath, outType, outPath):
from apiclient.http import MediaFileUpload
valid_output = [
You can’t perform that action at this time.