Skip to content

Instantly share code, notes, and snippets.

View chmodsss's full-sized avatar
🎵

Sivasurya Santhanam chmodsss

🎵
View GitHub Profile
@chmodsss
chmodsss / welcome_greeter.py
Last active July 13, 2016 07:29
python script using espeak for voice greeting with time and weather during system startup
import subprocess, datetime, time
welcome = "Hello Siva, welcome"
s = '-s 140'
g = '-g 0.8'
f = '-vf3'
a = '-a 150'
day = datetime.date.today().strftime('%A')
month = datetime.date.today().strftime('%B')
date = datetime.date.today().strftime('%d')
'''
Grabbing current tweets using python's tweepy module
'''
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import logging
# get the twitter keys from https://dev.twitter.com/
ckey = ***
@chmodsss
chmodsss / copy_svnprop.sh
Created December 15, 2016 08:51
Bash script to copy svn properties between two different repositories.
#!/bin/sh
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
SRC_PATH=path/to/source/folder
DST_PATH=path/to/destination/folder
for src_dir in $(ls $SRC_PATH)
do
for src_file in $(ls $SRC_PATH/$src_dir)
do
src_fpath=$SRC_PATH/$src_dir/$src_file
@chmodsss
chmodsss / nn_dataprep.py
Created August 16, 2018 16:40
NN from scratch. data preparation
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
%matplotlib inline
dig = load_digits()
plt.gray()
plt.matshow(dig.images[25])
import pandas as pd
from keras.layers import Dense
from keras.models import Sequential
from keras.optimizers import RMSprop, Adadelta, Adam
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
dig = load_digits()
onehot_target = pd.get_dummies(dig.target)
x_train, x_val, y_train, y_val = train_test_split(dig.data, onehot_target, test_size=0.1, random_state=20)
import pandas as pd
import numpy as np
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
dig = load_digits()
onehot_target = pd.get_dummies(dig.target)
x_train, x_val, y_train, y_val = train_test_split(dig.data, onehot_target, test_size=0.1, random_state=20)
def sigmoid(s):
@chmodsss
chmodsss / tetris.ipynb
Created August 29, 2018 22:58
tetris.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chmodsss
chmodsss / textgen_data_prep.py
Created September 18, 2018 09:19
Text generation 1
import string
puncts = string.punctuation.replace('.','')
punct = str.maketrans('','', puncts)
data = open('story.txt','r').read()
# data pre-processing only for alphabet strings
def clean(xx):
return ' '.join(x for x in xx.split() if not x.isnumeric())
@chmodsss
chmodsss / textgen_onehot.py
Created September 18, 2018 12:58
Text generation 2
import collections
import pandas as pd
import numpy as np
sents = [s for s in cdata.split()]
vocab = sorted(collections.Counter(sents))
vocab2idx = {v:idx for idx,v in enumerate(vocab)}
idx2vocab = {idx:v for idx,v in enumerate(vocab)}
@chmodsss
chmodsss / disc_genr.py
Created December 30, 2019 19:16
Discriminator Generator in GAN
class Discriminator(nn.Module):
def __init__(self):
super().__init__()
ip_emb = 784
emb1 = 256
emb2 = 128
out_emb = 1
self.layer1 = nn.Sequential(