Skip to content

Instantly share code, notes, and snippets.

View vgoklani's full-sized avatar

Vishal Goklani vgoklani

View GitHub Profile
@vgoklani
vgoklani / stats.py
Created February 1, 2019 23:45 — forked from impshum/stats.py
Get mongodb stats using python with pymongo
from pymongo import MongoClient
try:
client = MongoClient('localhost')
db = client.searchfollow
except:
print("Could not connect to MongoDB")
call = db.command("dbstats")
@vgoklani
vgoklani / Pytorch Wavenet.ipynb
Created November 11, 2018 16:26 — forked from lirnli/Pytorch Wavenet.ipynb
Pytorch Wavenet
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vgoklani
vgoklani / Pytorch RNN.ipynb
Created November 7, 2018 16:38 — forked from lirnli/Pytorch RNN.ipynb
Pytorch RNN examples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vgoklani
vgoklani / Simple Dilation Network.ipynb
Created November 7, 2018 16:00 — forked from lirnli/Simple Dilation Network.ipynb
Simple Dilation Network to generate sine waves
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vgoklani
vgoklani / Zoom.ipynb
Created November 7, 2018 15:53 — forked from lirnli/Zoom.ipynb
Attention layer in neural networks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vgoklani
vgoklani / pad_packed_demo.py
Created October 23, 2018 20:11 — forked from Tushar-N/pad_packed_demo.py
How to use pad_packed_sequence in pytorch
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
seqs = ['gigantic_string','tiny_str','medium_str']
# make <pad> idx 0
vocab = ['<pad>'] + sorted(set(''.join(seqs)))
# make model
@vgoklani
vgoklani / parser.py
Last active September 5, 2018 20:23 — forked from pieceofsummer/parser.py
Google Wifi diagnostic report parser
#!/usr/bin/python
import os, sys, gzip
from StringIO import StringIO
from datetime import datetime
def readByte(f):
return ord(f.read(1))
def readInt(f):
l = 0
@vgoklani
vgoklani / tweet_utils.py
Created August 5, 2018 23:40 — forked from timothyrenner/tweet_utils.py
Python Utilities for Tweets
from datetime import datetime
import string
from nltk.stem.lancaster import LancasterStemmer
from nltk.corpus import stopwords
#Gets the tweet time.
def get_time(tweet):
return datetime.strptime(tweet['created_at'], "%a %b %d %H:%M:%S +0000 %Y")
@vgoklani
vgoklani / dns.py
Created July 19, 2018 04:41 — forked from infra-0-0/dns.py
python3.5 asyncio dns resolver, based on code from who knows where
"""
The most simple DNS client written for Python with asyncio:
* Only A record is support (no CNAME, no AAAA, no MX, etc.)
* Almost no error handling
* Doesn't support fragmented UDP packets (is it possible?)
"""
import asyncio
import logging
@vgoklani
vgoklani / airflow-python3.sh
Created April 20, 2018 19:32 — forked from zacgx/airflow-python3.sh
Installing Airflow with CeleryExcuter, using PostgreSQL as metadata database and Redis for Celery message broker
# this script has been tested and worked in a freshly installed Ubuntu 16.04 and 16.10
# it assumes that you are running airflow in a private netowrk and no need to be worry about outside access
# if that's not the case, the lines for PostgreSQL and Redis in this script need to be updated accordingly
# run as root
sudo su
# initial system updates and installs
apt-get update && apt-get upgrade -y && apt-get autoremove && apt-get autoclean
apt-get -y install build-essential binutils gcc make git htop nethogs tmux