Skip to content

Instantly share code, notes, and snippets.

Avatar

Roshan Raj roshanraj

View GitHub Profile
View abc.py
{
"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
postgres docker compose
View docker-compose.yaml
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 Oct 3, 2018
using map in templates
View maptotemplate.go
package main
import (
"encoding/json"
"fmt"
"text/template"
"os"
)
type StatusType struct {
View safari-reaper.html
<!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
View js - html santize
var entityMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
'/': '&#x2F;',
'`': '&#x60;',
'=': '&#x3D;'
};
@roshanraj
roshanraj / sentiment_classification.py
Created Jan 30, 2018 — forked from bonzanini/sentiment_classification.py
Sentiment analysis with scikit-learn
View sentiment_classification.py
# 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 Jan 11, 2018 — forked from malomarrec/tensorport_minimal_distributed_tensorflow.py
The minimal template to use distributed TensorFlow on TensorPort
View tensorport_minimal_distributed_tensorflow.py
# 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 Dec 19, 2017 — forked from j314erre/text_cnn.py
load pre-trained word2vec into cnn-text-classification-tf
View text_cnn.py
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__(
View gist:c261b0753b4231c2c968968537cf2662
# Edit ~/.bash_profile
export GOPATH=/Users/username/go
export PATH=$GOPATH/bin:$PATH
# Reload profile : source ~/.bash_profile
@roshanraj
roshanraj / multipart_upload.go
Created Jan 20, 2017 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
View multipart_upload.go
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
You can’t perform that action at this time.