Skip to content

Instantly share code, notes, and snippets.

View saiakarsh193's full-sized avatar
✌️
안녕!

Sai Akarsh saiakarsh193

✌️
안녕!
View GitHub Profile
@saiakarsh193
saiakarsh193 / vs_profile_dev
Last active April 3, 2024 05:28
vscode profile (dev) with extensions and setting informations
{"name":"dev","settings":"{\"settings\":\"{\\r\\n \\\"editor.guides.bracketPairs\\\": true,\\r\\n \\\"workbench.iconTheme\\\": \\\"material-icon-theme\\\",\\r\\n \\\"remote.SSH.remotePlatform\\\": {\\r\\n \\\"kiet\\\": \\\"linux\\\",\\r\\n \\\"hermes\\\": \\\"linux\\\"\\r\\n },\\r\\n \\\"workbench.colorTheme\\\": \\\"Theme Darker\\\",\\r\\n \\\"editor.fontFamily\\\": \\\"Cascadia Code\\\",\\r\\n \\\"terminal.integrated.fontFamily\\\": \\\"Cascadia Code\\\",\\r\\n \\\"editor.fontLigatures\\\": true,\\r\\n \\\"window.zoomLevel\\\": 1,\\r\\n \\\"material-icon-theme.saturation\\\": 1,\\r\\n \\\"material-icon-theme.folders.theme\\\": \\\"specific\\\",\\r\\n \\\"material-icon-theme.folders.color\\\": \\\"#26a69a\\\",\\r\\n \\\"material-icon-theme.files.color\\\": \\\"#7cb342\\\"\\r\\n}\"}","extensions":"[{\"identifier\":{\"id\":\"eamodio.gitlens\",\"uuid\":\"4de763bd-505d-4978-9575-2b7696ecf94e\"},\"displayName\":\"GitLens — Git supercharged\"},{\"identifier\":{\
@saiakarsh193
saiakarsh193 / decorator.py
Created May 1, 2023 16:21
sample codes for understanding how to make customized decorator wrappers
import time
import inspect
from functools import wraps
from typing import Any
def typechecked(func):
@wraps(func)
def inner_function(*args, **kwargs):
# dict of variable name and values
targs = inspect.signature(func).bind(*args, **kwargs).arguments
@saiakarsh193
saiakarsh193 / recur_dir_draw.py
Created September 14, 2022 04:09
My implementation of the tree command in python.
import os
import sys
import argparse
class Node():
def __init__(self, path):
self.abspath = os.path.abspath(path)
self.name = os.path.basename(self.abspath)
self.isdir = os.path.isdir(self.abspath)
self.children = []
@saiakarsh193
saiakarsh193 / manual_wallpaper_change.sh
Created June 15, 2022 09:52
Bash script to switch between wallpapers for single and dual monitor setup.
#!/bin/sh
man_wall_change()
{
if [[ $1 == 1 ]]
then
gsettings set org.gnome.desktop.background picture-options zoom
gsettings set org.gnome.desktop.background picture-uri "/usr/share/backgrounds/mine/Single/assassin_game_4k.jpg"
else
gsettings set org.gnome.desktop.background picture-options spanned
@saiakarsh193
saiakarsh193 / .zshrc
Last active April 3, 2024 05:29
Addition to .zshrc made by oh-my-posh
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@saiakarsh193
saiakarsh193 / .vimrc
Last active April 3, 2024 05:28
Vim dotfile
" customizing vim using .vimrc
" https://www.makeuseof.com/tag/5-things-need-put-vim-config-file/
" https://www.cyberciti.biz/faq/vi-show-line-numbers/
" https://www.freecodecamp.org/news/vimrc-configuration-guide-customize-your-vim-editor/
" Disable compatibility with vi which can cause unexpected issues.
set nocompatible
" Enable type file detection. Vim will be able to try to detect the type of file in use.
@saiakarsh193
saiakarsh193 / cuda_torch.py
Last active February 18, 2023 13:19
Torch CUDA notes
# https://discuss.pytorch.org/t/difference-between-cuda-0-vs-cuda-with-1-gpu/93080/8
# cude device initialization
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# or do
if(torch.cuda.is_available()):
device = torch.device("cuda")
print('Using GPU')
print('GPU count:', torch.cuda.device_count())
print('GPU device:', torch.cuda.get_device_name(0))
else:
@saiakarsh193
saiakarsh193 / colab_click.js
Created November 15, 2021 10:49
Keep Colab from disconnecting (when you are in a break) by pasting this in your chrome console
function KeepClicking()
{
console.log("Clicking");
document.querySelector("colab-connect-button").click();
}
setInterval(KeepClicking, 60 * 1000);
@saiakarsh193
saiakarsh193 / otp.py
Created October 23, 2021 09:48
One-time-pad cypher
def add_letter(src, tar):
return chr((((ord(src) - 97) + (ord(tar) - 96)) % 26) + 97)
def remove_letter(src, tar):
return chr((((ord(src) - 97) - (ord(tar) - 96)) % 26) + 97)
def clean_word(src):
src = src.lower()
ans = ""
for i in range(len(src)):
@saiakarsh193
saiakarsh193 / invkine.py
Created October 23, 2021 09:46
2 arm inverse kinematics using turtle
import math
import turtle
import time
import numpy as np
def get_POI(l1, l2, a, b):
dist = math.sqrt(a**2 + b**2)
if(dist > l1 + l2 or dist < abs(l1 - l2)):
return
if(b == 0):