Skip to content

Instantly share code, notes, and snippets.

@gaurav-gogia
gaurav-gogia / bigfile.go
Last active July 6, 2019 05:20
processing big files in go
package main
import (
"bufio"
"log"
"os"
)
const BUFF = 1024 * 1024
@gaurav-gogia
gaurav-gogia / facenettest.py
Created April 12, 2019 19:09
trying facenet
import os
import cv2
import time
import glob
import facenet
import fr_utils
import numpy as np
import tensorflow as tf
from numpy import genfromtxt
from keras import backend as K
@gaurav-gogia
gaurav-gogia / vgg.py
Created April 11, 2019 17:16
vggface attempt at face recognition
import os
import keras
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from os.path import isfile, join
from sklearn.decomposition import PCA
from keras.optimizers import Adam, SGD
from keras.layers import ZeroPadding2D
from keras.layers import Conv2D, MaxPool2D
@gaurav-gogia
gaurav-gogia / threaded.go
Created March 20, 2019 17:10
copying from src to dst big file
func (dd *opts) run() error {
var thread int64
var names []string
done := make(chan bool)
size := getsize(*dd.src)
for i := int64(0); i < size; i += *dd.buffersize {
dstname := partfile + strconv.FormatInt(i, 10)
names = append(names, dstname)
@gaurav-gogia
gaurav-gogia / copy.go
Last active February 23, 2019 15:53
trying to copy a file concurrenlty
func copy() error {
src, size, err := open(dd)
if err != nil {
return err
}
defer src.Close()
dst, err := os.Create(dd)
if err != nil {
return err
@gaurav-gogia
gaurav-gogia / ipo.py
Created October 22, 2018 17:32
Trying to trim space in a csv file. Getting this exception: ValueError: could not convert string to float: '-\xa01.38'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from patsy import dmatrix
from sklearn.ensemble import RandomForestClassifier
from sklearn import linear_model
%matplotlib inline
ipos = pd.read_csv('./scoop.csv')
ipos
@gaurav-gogia
gaurav-gogia / vanilla_js_xhr.js
Created October 11, 2018 05:14
Trying to perform ajax/xhr via vanillajs. Am I doing this right? If not then please advise. Thanks :)
const XMLHttpRequest = require('xhr2');
const xhr = new XMLHttpRequest();
xhr.open('GET', 'http://twitter.com/DesmondANIMUS/');
xhr.send(null);
xhr.onreadystatechange = function () {
var DONE = 4; // readyState 4 means the request is done.
var OK = 200; // status 200 is a successful return.
if (xhr.readyState === DONE) {
import os
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from sklearn.cluster import DBSCAN
@gaurav-gogia
gaurav-gogia / inspection.json
Created July 27, 2018 21:54
docker inspection
[
{
"Id": "66bd56ebc3a19c717b722e314efdddb3703c27120bbd79d3867cace1d6bd2787",
"Created": "2018-07-27T21:52:34.387739635Z",
"Path": "/sbin/tini",
"Args": [
"-g",
"--",
"/docker-entrypoint.sh",
"neo4j"
@gaurav-gogia
gaurav-gogia / index.html
Created July 20, 2018 12:07
exploring vue
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.jsdelivr.net/npm/@aspnet/signalr@1.0.2/dist/browser/signalr.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>SignalR 2018</title>