Skip to content

Instantly share code, notes, and snippets.

{
"src_path":"https://xavlabs-repository.s3.amazonaws.com/fnet/shafin/IMG_20190625_145657.jpg",
"dst_path":"https://xavlabs-repository.s3.amazonaws.com/fnet/baseIdCard/IMG_6591.JPG"
}
@roshanraj
roshanraj / docker-compose.yaml
Created May 11, 2019 09:14
postgres docker compose
version: '2'
services:
dbpostgres:
image: postgres
volumes:
- /private/var/lib/postgresql:/var/lib/postgresql
ports:
- "5432:5432"
environment:
POSTGRES_USER: username
@roshanraj
roshanraj / maptotemplate.go
Created October 3, 2018 04:44
using map in templates
package main
import (
"encoding/json"
"fmt"
"text/template"
"os"
)
type StatusType struct {
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
background: repeat url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/7QCIUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGscAVoAAxslRxwCAAACAAAcAnQAV8KpIENoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbGQgLSBodHRwOi8vd3d3LnJlZGJ1YmJsZS5jb20vcGVvcGxlL0NoYWV5b3VuZ1dpbGxOZXZlckNoYWVvbAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAA
var entityMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
'/': '&#x2F;',
'`': '&#x60;',
'=': '&#x3D;'
};
@roshanraj
roshanraj / sentiment_classification.py
Created January 30, 2018 10:52 — forked from bonzanini/sentiment_classification.py
Sentiment analysis with scikit-learn
# You need to install scikit-learn:
# sudo pip install scikit-learn
#
# Dataset: Polarity dataset v2.0
# http://www.cs.cornell.edu/people/pabo/movie-review-data/
#
# Full discussion:
# https://marcobonzanini.wordpress.com/2015/01/19/sentiment-analysis-with-python-and-scikit-learn
@roshanraj
roshanraj / tensorport_minimal_distributed_tensorflow.py
Created January 11, 2018 13:55 — forked from malomarrec/tensorport_minimal_distributed_tensorflow.py
The minimal template to use distributed TensorFlow on TensorPort
# Notes:
# You need to have the tensorport package installed (pip install tensorport)
# Export logs to /logs, your data is in /data.
# See example here https://github.com/tensorport/mnist/blob/master/mnist_conv.py
# and documentation here
import tensorflow as tf
from tensorport import get_data_path, get_logs_path
@roshanraj
roshanraj / text_cnn.py
Created December 19, 2017 19:57 — forked from j314erre/text_cnn.py
load pre-trained word2vec into cnn-text-classification-tf
import tensorflow as tf
import numpy as np
class TextCNN(object):
"""
A CNN for text classification.
Uses an embedding layer, followed by a convolutional, max-pooling and softmax layer.
"""
def __init__(
@roshanraj
roshanraj / gist:c261b0753b4231c2c968968537cf2662
Created October 22, 2017 18:30 — forked from molivier/gist:271bba5d67de1583a8e3
Set $GOPATH on Mac OSX : bash_profile
# Edit ~/.bash_profile
export GOPATH=/Users/username/go
export PATH=$GOPATH/bin:$PATH
# Reload profile : source ~/.bash_profile
@roshanraj
roshanraj / multipart_upload.go
Created January 20, 2017 13:02 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"