Skip to content

Instantly share code, notes, and snippets.

View yashkumaratri's full-sized avatar
☂️
:)

Yash Kumar Atri yashkumaratri

☂️
:)
View GitHub Profile
@yashkumaratri
yashkumaratri / wget_gdrive.sh
Created May 20, 2020 15:28
Download google drive files by wget
For small files
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1rC6LWGNkHaZkuojCEWDqSKcDGwFMBTYZ' -O transformer_semeval.clf
For large files
wget --load-cookies cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1rC6LWGNkHaZkuojCEWDqSKcDGwFMBTYZ' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1rC6LWGNkHaZkuojCEWDqSKcDGwFMBTYZ" -O transformer_semeval.clf
Learning Structured Representation for Text Classification
via Reinforcement Learning
https://github.com/keavil/AAAI18-code
@yashkumaratri
yashkumaratri / df_reduce.py
Created June 6, 2019 12:16
Reduce Pandas dataframe memory usage.
def reduce_mem_usage(df):
""" iterate through all the columns of a dataframe and modify the data type
to reduce memory usage.
"""
start_mem = df.memory_usage().sum() / 1024**2
print('Memory usage of dataframe is {:.2f} MB'.format(start_mem))
for col in df.columns:
col_type = df[col].dtype
@yashkumaratri
yashkumaratri / embed.py
Created April 3, 2019 17:09 — forked from Tony607/embed.py
Keras + Universal Sentence Encoder = Transfer Learning for text data | DLology
import tensorflow as tf
import tensorflow_hub as hub
module_url = "https://tfhub.dev/google/universal-sentence-encoder-large/3"
# Import the Universal Sentence Encoder's TF Hub module
embed = hub.Module(module_url)
# Compute a representation for each message, showing various lengths supported.
messages = ["That band rocks!", "That song is really cool."]
with tf.Session() as session:
@yashkumaratri
yashkumaratri / jupyter_clean_output
Created March 15, 2019 06:25
clearing jupyter output for every for loop
from IPython import display
for i in range(100):
display.clear_output(wait=True)
print(i)
@yashkumaratri
yashkumaratri / cuda_ubuntu.sh
Created March 12, 2019 05:16
cuda_10_setuup
sudo add-apt-repository ppa:graphics-drivers -y
sudo apt-get update
sudo apt-get install nvidia-driver-418 nvidia-utils-418 nvidia-settings -y
wget -N https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.105_418.39_linux.run
wget -N http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/libcudnn7_7.5.0.56-1+cuda10.1_amd64.deb
sudo ./cuda_10.1.105_418.39_linux.run --override --silent --toolkit --no-opengl-libs
sudo dpkg -i libcudnn7_7.5.0.56-1+cuda10.1_amd64.deb
sudo apt-get install libcupti-dev -y
@yashkumaratri
yashkumaratri / crystal_pack
Last active February 27, 2019 10:49
Things I need
# Setting default encoding python ENV - Ubuntu (Linux) - /bin/bash
export PYTHONIOENCODING=UTF-8
*****************************************************************************************
# Making python server on any directory
python3 -m http.server
@yashkumaratri
yashkumaratri / server.sh
Created February 1, 2019 05:44
file server using python
cd ~ && python3 -m http.server 8082
@yashkumaratri
yashkumaratri / ttyd_tmux
Created January 2, 2019 13:05
hosting TMUX on browser in read only mode
ttyd -p 5055 -i 0.0.0.0 -R tmux a -r -t 1
@yashkumaratri
yashkumaratri / Google Colab SSH
Created December 31, 2018 05:19
SSH into google colab
#CODE
#Generate root password
import random, string
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd