Skip to content

Instantly share code, notes, and snippets.

View kunalkushwaha's full-sized avatar

Kunal Kushwaha kunalkushwaha

View GitHub Profile
@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.
@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)
@kunalkushwaha
kunalkushwaha / container.go
Created February 26, 2015 11:41
Container management using libcontainer.
package main
import (
"fmt"
"os"
"log"
"syscall"
"github.com/docker/libcontainer"
"github.com/docker/libcontainer/configs"
_ "github.com/docker/libcontainer/devices"
@kunalkushwaha
kunalkushwaha / get_time.go
Created April 16, 2015 12:05
Fetch time from timeapi.org and set to system, Alternative to ntp
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
"bytes"
"os/exec"
@kunalkushwaha
kunalkushwaha / docker-machine-5-0-log.md
Created November 5, 2015 04:20
Output of "docker-machine --debug create -d virtualbox default" for docker-machine v5.0
kunal@kunal-PC MINGW64 ~
$ docker-machine --debug create -d virtualbox default
Docker Machine Version: 0.5.0 (04cfa58)
Found binary path at C:\Program Files\Docker Toolbox\docker-machine-driver-virtualbox.exe
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:53250
() Calling RpcServerDriver.GetVersion
Using API Version 1
() Calling RpcServerDriver.SetConfigRaw
@kunalkushwaha
kunalkushwaha / docker-ssl-cert-generate
Created November 16, 2015 04:16 — forked from cameron/docker-ssl-cert-generate
Generate self-signed SSL certs for docker client <— HTTPS —> daemon
#! /bin/bash
# HEADS UP! Make sure to use '*' or a valid hostname for the FDQN prompt
echo 01 > ca.srl
openssl genrsa -des3 -out ca-key.pem
openssl req -new -x509 -days 365 -key ca-key.pem -out ca.pem
openssl genrsa -des3 -out server-key.pem
openssl req -new -key server-key.pem -out server.csr
@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;