Skip to content

Instantly share code, notes, and snippets.

View kunalkushwaha's full-sized avatar

Kunal Kushwaha kunalkushwaha

View GitHub Profile
@kunalkushwaha
kunalkushwaha / binary_tree.c
Created March 30, 2013 18:47
Binary tree creation and in-order printing.
#include <stdio.h>
#include <malloc.h>
typedef struct _node
{
int data;
struct _node *left;
struct _node *right;
}node;
@kunalkushwaha
kunalkushwaha / stack.c
Created March 30, 2013 18:52
Stack implementation with link list. push, pop and dump_stack function implementation.
#include <stdio.h>
#include <malloc.h>
#define SUCCESS 0
#define INVAILD_PTR -1
#define NO_MEM -2
#define INIT_NODE(node) node->next = node->prev = NULL
struct node_type
{
@kunalkushwaha
kunalkushwaha / build_ctags_csope.sh
Created November 11, 2013 06:13
Build ctags for cscope
#!/bin/bash
find -name '*.c' -o -name '*.h' > cscope.files
cscope -b
CSCOPE_DB=cscope.out; export CSCOPE_DB
ctags -L cscope.files
@kunalkushwaha
kunalkushwaha / gist:7690938
Created November 28, 2013 12:12
Hearbeat on centos 6.3
Problem with default installation of hearbeat on centos 6.3 is that it doent run.
ln -s /usr/lib64/heartbeat/heartbeat /usr/libexec/heartbeat/heartbeat
fix the issue.
@kunalkushwaha
kunalkushwaha / stack.go
Created November 4, 2014 11:25
simple stack implementation in go
package main
import (
"fmt"
)
type NodeElement struct {
data interface{}
next *NodeElement
}
@kunalkushwaha
kunalkushwaha / lru.go
Last active August 29, 2015 14:09
lru.go
package main
import (
"fmt"
"container/list"
"strconv"
)
type LRUObj struct {
lruLookup map[string]interface{}
lru *list.List
@kunalkushwaha
kunalkushwaha / set_go_env.sh
Created November 28, 2014 17:25
Set go VIM environment for golang
mkdir -p $HOME/.vim/ftdetect
mkdir -p $HOME/.vim/syntax
mkdir -p $HOME/.vim/autoload/go
ln -s $GOROOT/misc/vim/ftdetect/gofiletype.vim $HOME/.vim/ftdetect/
ln -s $GOROOT/misc/vim/syntax/go.vim $HOME/.vim/syntax
ln -s $GOROOT/misc/vim/autoload/go/complete.vim $HOME/.vim/autoload/go
echo "syntax on" >> $HOME/.vimrc
@kunalkushwaha
kunalkushwaha / lxd_link_parser.go
Last active August 29, 2015 14:13
lxd servers link parser.
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
)
/*
sample json
@kunalkushwaha
kunalkushwaha / image_store_protocol.txt
Created February 19, 2015 17:29
image store protocol
Just left a couple of comments in there.
I also think there's still a bit of a misunderstanding as to how we expect this to work, so let me try to clarify this a bit :)
The lxc command line tool has a concept of "remotes" which can be:
A LXD host
An image server using the lxc-images protocol (such as https://images.linuxcontainers.org)
An image server using the system-image protocol (such as https://system-image.ubuntu.com)
A registry pointing to a set of remotes using one of the aforementioned protocols (such as https://registry.linuxcontainers.org)