Skip to content

Instantly share code, notes, and snippets.

import unittest
from pyramid import testing
from paste.deploy.loadwsgi import appconfig
from webtest import TestApp
from mock import Mock
from sqlalchemy import engine_from_config
from sqlalchemy.orm import sessionmaker
from app.db import Session
@hariharan-uno
hariharan-uno / Installation
Created November 10, 2013 16:13
Elastic Search with MySQL
First extract Elastic Search from tarball. (Make sure you are running the latest java version)
Then cd into the folder and type:
bin/plugin -install river-jdbc -url http://bit.ly/1iovWV9
Get the latest version of the JDBC river for elastic search from https://github.com/jprante/elasticsearch-river-jdbc ( or from the url above)
Download a JDBC driver jar from your vendor's site (here MySQL) and put the jar into the folder of the plugin $ES_HOME/plugins/river-jdbc.
For MySQL, the JDBC driver can be obtained from http://dev.mysql.com/downloads/connector/j/
@hariharan-uno
hariharan-uno / mazesolver.go
Last active January 3, 2016 01:59
Maze solver in Go
package main
import (
"fmt"
"strconv"
"strings"
)
type Maze struct {
x [5][5]int
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int
main(int argc, char *argv[])
{
int pipefd[2];
pid_t cpid;
//Copied from https://groups.google.com/forum/#!msg/golang-nuts/dEfqPOSccIc/hoq8jdPTBIcJ
package main
import(
"crypto/rand"
"crypto/tls"
"io/ioutil"
"log"
"net"
package main
import (
"github.com/gorilla/websocket"
"io"
"log"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
@hariharan-uno
hariharan-uno / incrementingslugs.go
Created June 20, 2014 09:09
Auto incrementing slugs
package main
import (
"fmt"
"strconv"
"github.com/extemporalgenome/slug"
)
type person struct {
@hariharan-uno
hariharan-uno / vagrant_marksman.sh
Created October 14, 2015 06:20
Shell script to run marksman with correct ports and nats in vagrant
HOSTIP=`netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10`
/home/vagrant/recond -marksman=http://$HOSTIP:3000 -nats=tcp://$HOSTIP:4222 &
echo "recond started..."
@hariharan-uno
hariharan-uno / main.go
Created August 23, 2016 19:33 — forked from julz/main.go
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@hariharan-uno
hariharan-uno / main.go
Created August 25, 2016 19:35 — forked from lizrice/main.go
Container from scratch
package main
// @lizrice, mostly copied from @doctor_julz: https://gist.github.com/julz/c0017fa7a40de0543001
import (
"fmt"
"os"
"os/exec"
"syscall"
)