Skip to content

Instantly share code, notes, and snippets.

View anupam-io's full-sized avatar
Coffee

anupam anupam-io

Coffee
  • Range Security
  • Bangalore
  • 18:53 (UTC +05:30)
View GitHub Profile
@anupam-io
anupam-io / tensorflow-on-chars74k.ipynb
Last active April 11, 2021 13:51
Tensorflow-on-chars74K.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anupam-io
anupam-io / main.py
Created February 27, 2021 10:44
Voice logging function in Python using gTTS
def vlog(s):
s = str(s)
from gtts import gTTS
from os import system
language = 'en'
output = gTTS(text=s, lang=language, slow=False)
system("mkdir -p .vlogs")
output.save("./.vlogs/output.mp3")
system("ffplay -nodisp -autoexit ./.vlogs/output.mp3 >/dev/null 2>&1")
@anupam-io
anupam-io / flatten.py
Last active February 22, 2021 09:11
Flattening a colored image by converting into grayscale
import numpy as np
import cv2
img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
img = cv2.resize(img, (20, 20))
img = np.array(img).ravel()
img = img.reshape(-1)
print(img)
@anupam-io
anupam-io / ditw.md
Created February 20, 2021 14:14
Delving into the white paper series
@anupam-io
anupam-io / rm.sql
Created February 19, 2021 16:35
Downgrade mysql settings for testing.
SET GLOBAL validate_password.length = 4;
SET GLOBAL validate_password.mixed_case_count = 0;
SET GLOBAL validate_password.number_count = 0;
SET GLOBAL validate_password.policy = LOW;
SET GLOBAL validate_password.special_char_count = 0;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';
@anupam-io
anupam-io / git.MD
Last active May 19, 2021 12:54
The minimalistic git knowledge that you must know.

Git: The version control system

Initializing a git repo

  • git init: initialize a git repository

Connecting to a Online repository

  • git remote add origin https://github.com/akcgjc007/avl_tree.git: Connect your git to an existring online repository
  • git remote -v: Show connected repositories

Adding files

  • git add .: Add all files present in the current directory.
  • git add : Add a particular file.
@anupam-io
anupam-io / main.sql
Created February 15, 2021 07:32
How to set custom values instead of NULL in outer joins?
drop database if exists db;
create database db;
use db;
drop table if exists a,b;
create table a(attr1 varchar(50), score int(10));
insert into a (attr1, score)values
("info1", 1), ("info2", 2);
@anupam-io
anupam-io / main.py
Created February 10, 2021 06:28
Testing various approaches of iterating through python lists using indexes
from time import time
n = 10**4
arr = [i for i in range(n)]
def test_fun(i):
# some compuatations
a =0
b =0
a+=arr[i]*arr[i]*arr[i]*arr[i]*arr[i]*arr[i]
b+=arr[i]+arr[i]+arr[i]+arr[i]+arr[i]+arr[i]
@anupam-io
anupam-io / main.py
Created February 7, 2021 15:19
GapFinder animation with matplotlib
import matplotlib.pyplot as plt
from random import randint, uniform
plt.rcParams['figure.figsize'] = [10, 6]
n = 20
x = [uniform(0, 100) for i in range(n)] # x axis position
y = [uniform(0, 100) for i in range(n)] # y axis position
rad = [uniform(0, 1000) for i in range(n)] # radius of the circle
cat = [randint(1, 5) for i in range(n)] # category
@anupam-io
anupam-io / main.py
Created February 5, 2021 11:07
Live animation from X and Y values in Python
import matplotlib.pyplot as plt
import numpy as np
import time
from random import randint
n = 10
x = []
y = []
plt.ion()