Skip to content

Instantly share code, notes, and snippets.

View Rajan-sust's full-sized avatar
🎯
Focusing

Rajan Saha Raju Rajan-sust

🎯
Focusing
View GitHub Profile
@Rajan-sust
Rajan-sust / .bashrc
Created March 29, 2019 03:40
Ubuntu 18.04.2 LTS .bashrc file
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@Rajan-sust
Rajan-sust / understanding-word-vectors.ipynb
Last active June 3, 2019 05:36 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Rajan-sust
Rajan-sust / Dijkstra.cpp
Last active June 28, 2019 10:03
C++ Implementation of Dijkstra Algorithm
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout<<#x<<" is "<<endl
using ll = long long;
#define x first
#define y second
@Rajan-sust
Rajan-sust / dataframe2tsv.py
Created October 22, 2019 17:14
Saving dataframe as a tsv file format
# Import pandas library
import pandas as pd
# initialize list of lists
data = [['tom', 10], ['nick', 15], ['juli', 14]]
# Create the pandas DataFrame
df = pd.DataFrame(data, columns = ['Name', 'Age'])
df.to_csv('filename.tsv', sep = '\t', encoding='utf-8', index=False)
@Rajan-sust
Rajan-sust / sgd.py
Created May 22, 2021 00:58
Stochastic Gradient Descent
from random import random, seed
from datetime import datetime
seed(datetime.utcnow().microsecond)
def main():
X = list(range(0, 25))
Y = [*map(lambda x: 2.0 * x + 3, X)]
@Rajan-sust
Rajan-sust / Dockerfile
Last active July 7, 2021 22:27
How to dockerize a project?
FROM ubuntu:latest
WORKDIR /app
COPY main.sh .
import argparse
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--id_file', required=True,
help='file path of ids in text format')
parser.add_argument('--input', required=True,
@Rajan-sust
Rajan-sust / insertion.cpp
Created July 16, 2022 02:06
C++ Insertion Sort
void insertion_sort(vector<int> &v) {
int n = v.size();
for(int i = 1; i < n; i++) {
for(int j = i; j > 0; j--) {
if(v[j] < v[j-1]) {
swap(v[j], v[j-1]);
} else {
break;
}
}
from collections import defaultdict
def get_frequency(char_count, start, end):
total = sum(x for _, x in char_count.items())
for value in range(start, end):
letter = chr(value)
try:
print(f'{letter}\t{char_count[letter]}')
except:
$ docker pull mariadb
$ VOLUME=DB
$ docker volume create ${VOLUME}
$ docker run --detach \
-p 3306:3306 \
-v ${VOLUME}:/var/lib/mysql \
--name MariaDB \