Skip to content

Instantly share code, notes, and snippets.

View tusharbihani's full-sized avatar

Tushar Bihani tusharbihani

  • Pune
View GitHub Profile
@calroc
calroc / dre.py
Created June 26, 2018 01:05
Dirty but functional implementation of Brzozowski’s derivatives of regular expressions.
from itertools import product
phi = frozenset()
y = frozenset({''})
syms = O, l = frozenset({'0'}), frozenset({'1'})
AND, CONS, KSTAR, NOT, OR = 'and cons * not or'.split()
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@binaryfoundry
binaryfoundry / fizzbuzz.py
Created January 30, 2018 15:18
Port of Joel Grus Fizz Buzz in Tensorflow to Keras
from keras.models import Sequential
from keras.layers import Dense
import numpy as np
np.random.seed(7)
NUM_DIGITS = 12
def binary_encode(i, num_digits):
return np.array([i >> d & 1 for d in range(num_digits)])
@harv
harv / glibc-2.17_centos6.sh
Last active March 1, 2024 08:42
update glibc to 2.17 for CentOS 6
#! /bin/sh
# update glibc to 2.17 for CentOS 6
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm
sudo rpm -Uvh glibc-2.17-55.el6.x86_64.rpm \
@shibuiwilliam
shibuiwilliam / keras_fizzbuzz
Created February 11, 2017 12:44
fizzbuzz in Keras
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
from keras.utils import np_utils
from keras.layers import Dense
from keras.models import Model
# create training data
def binary_encode(i, num_digits):
@dirko
dirko / keras_bidirectional_tagger.py
Created August 11, 2016 05:32
Keras bidirectional LSTM NER tagger
# Keras==1.0.6
from keras.models import Sequential
import numpy as np
from keras.layers.recurrent import LSTM
from keras.layers.core import TimeDistributedDense, Activation
from keras.preprocessing.sequence import pad_sequences
from keras.layers.embeddings import Embedding
from sklearn.cross_validation import train_test_split
from keras.layers import Merge
from keras.backend import tf

NLTK API to Stanford NLP Tools compiled on 2015-12-09

Stanford NER

With NLTK version 3.1 and Stanford NER tool 2015-12-09, it is possible to hack the StanfordNERTagger._stanford_jar to include other .jar files that are necessary for the new tagger.

First set up the environment variables as per instructed at https://github.com/nltk/nltk/wiki/Installing-Third-Party-Software

@svpino
svpino / RotatingMatrix90DegreesInPlace.java
Last active June 8, 2018 11:00
Programming challenge: rotating a matrix 90 degrees in place
// Programming challenge: rotating a matrix 90 degrees in place
// Original post: https://blog.svpino.com/2015/05/10/programming-challenge-rotating-a-matrix-90-degrees-in-place
public class RotatingMatrix90DegreesInPlace {
private static int[][] matrix = {
{ 1, 2, 3, 4 },
{ 5, 6, 7, 8 },
{ 9, 10, 11, 12 },
{ 13, 14, 15, 16 }
@StevenMaude
StevenMaude / tfidf_features.py
Created July 21, 2014 13:35
Do TF-IDF with scikit-learn and print top features
#!/usr/bin/env python
# encoding: utf-8
import codecs
import os
import sys
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer