Skip to content

Instantly share code, notes, and snippets.

@sarathsp06
sarathsp06 / StrToMap.go
Created October 30, 2015 12:53
A function to converta a striuct to map of string to interface
package main
import (
"fmt"
"reflect"
)
//StructToMap converts a struct to map of string to interface
//Its uses the tag 'map' to check the name to be used
//if the value is nil no key is added
@sarathsp06
sarathsp06 / goget-bitbucket.sh
Last active August 29, 2015 14:24
Golang - go get initializer tool gor private repositories in bitbucket
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
args=("${@}")
package="${args[0]}"
echo -n "Enter your bitbucket username "
read user_name
@sarathsp06
sarathsp06 / angular_relativeDate.js
Last active May 9, 2019 09:07
Angular filter to convert a time in milliseconds to relative human readable time
(function(){
"use strict":
angular.module('ng-relativeDate',[])
.filter('ngrelativeDate',function(){
/**
* [humanreadableDate converts the timestamp into human readable time ]
* @param {Int} timestamp - time as number of milliseconds since 1970/01/01:
* @return {string} relative time corresponding to timestamp
*/
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@cjrd
cjrd / README.md
Last active February 20, 2025 19:04
Interactive tool for creating directed graphs using d3.js.

directed-graph-creator

Interactive tool for creating directed graphs, created using d3.js.

Demo: http://bl.ocks.org/cjrd/6863459

Operation:

  • drag/scroll to translate/zoom the graph
@sarathsp06
sarathsp06 / gist:6142041
Created August 2, 2013 18:09
Js File formatter
#!/usr/bin/python
import urllib2, re,sys
a=''
if len(sys.argv) == 2:
a=sys.argv[1]
else:
a=raw_input("Enter the url :")
req = urllib2.Request(a)
resp = urllib2.urlopen(req)
html = resp.read()
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000