Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
URL="http://localhost:19065"
BROWSER="firefox"
#######################
STATUS_CODE=`curl -s -o /dev/null -w "%{http_code}" $URL/status`
if STATUS_CODE==200; then
echo "Server ready"
SESSION_ID=`curl -s -u sankha1:AnyXX1mpzakvChYMgrC4 --data '{"desiredCapabilities":{"browserName":"firefox", "platform":"MAC"}}' $URL/session |
@ngsankha
ngsankha / main.rs
Created January 23, 2016 19:09
ChakraCore embedding
use std::mem;
struct JsRuntimeHandle;
struct JsThreadServiceCallback;
struct JsRef;
type JsContextRef = JsRef;
type JsValueRef = JsRef;
type JsErrorCode = usize;
enum JsRuntimeAttributes {

Keybase proof

I hereby claim:

  • I am ngsankha on github.
  • I am sankha (https://keybase.io/sankha) on keybase.
  • I have a public key whose fingerprint is 8B67 5492 3C14 4F02 B974 BA0B 41D6 FE40 F324 AAF6

To claim this, I am signing this object:

@ngsankha
ngsankha / rust-watch.sh
Created June 17, 2014 08:15
rust-watch
#!/bin/sh
# This script will recompile a rust project using `make`
# every time something in the specified directory changes.
#
# It is designed to be used in a rust-empty style crate.
# $1: Directory to watch
# src by default
# $2: Command to execute
# `make` by default
@ngsankha
ngsankha / bootstrap.sh
Created November 5, 2013 20:22
Script that I use to bootstrap an empty system to my dev environment
#!/bin/bash
# Script that I use to bootstrap an empty system to my dev environment
# Author: Sankha Narayan Guria
# License: MIT
# List of version control systems that I generally have installed
function get_vcs {
apt-get install git mercurial subversion
}
@ngsankha
ngsankha / clone
Last active December 20, 2015 03:39
Clones all your original repositories at once.
#!/usr/bin/python
import sys, httplib, json, subprocess
con = httplib.HTTPSConnection("api.github.com")
def cloneRepos(user):
request = "/users/" + user + "/repos"
con.request("GET", request)
obj = json.load(con.getresponse())
for repo in obj:
@ngsankha
ngsankha / JSON-RPC.md
Last active December 19, 2015 08:28
Demo JSON-RPC implementation

This is a very simple implementation of the JSON-RPC spec v1 in PHP. Take a look at it at http://json-rpc.org/wiki/specification.

Here what you do from your webapp.

$.post('/rpc.php', {'method': 'echo',
                    'params': ['Hello JSON-RPC'],
                    'id': Math.floor(Math.random()*100)
                   }, function (data) {
                        alert("I received result: " + data.result);
@ngsankha
ngsankha / events.js
Last active December 19, 2015 01:19
Simple event handling mechanism
"use strict";
/* EventEmitter - simple event handling
*
* Use var myObj = Object.create(EventEmitter) to inherit the functions
* Use myObj.on('event', callback) to attach event handlers
* Use emit('event') to trigger the event handlers
*/
var EventEmitter = {

##How to start?

  1. Fork the repository on GitHub.
  2. Create your public gists (aka posts).
  3. Note the gist ID number. It’s usually a longish number like 5711471.
  4. Edit the config.js file on GitHub online to add the post ID.

You can find out the details of changing other settings of your blog on the wiki page.

##Issues

What is it?

A static blogging tool for hackers. You create your posts in a GitHub Gist. Add them to your blog on Grite and it just shows up.

Why?

Other static site generators need you to generate the site, once you change the content. Here you don't need to. You create or update a gist, and you can add posts to your blog, all of it online from GitHub!

This means that you can use all the goodness of Git in your posts, you have revision history, you can fork other posts, etc. You do this all online, without cloning the repository on your machine.