Skip to content

Instantly share code, notes, and snippets.

View shreewatsa's full-sized avatar

shreewatsa shreewatsa

  • kathmandu , nepal
  • 01:51 (UTC +05:45)
View GitHub Profile
@shreewatsa
shreewatsa / dotfiles.md
Created January 19, 2024 02:40
Dotfiles (Managing and version controlling of dotfiles)

Create a bare repo and push to Github.

1. Create an empty repo in GitHub (without README, .gitignore, Licence)

2. Create a bare repo.

cd ~;
git init --bare ~/dotfiles;
echo 'alias bare="/usr/bin/git --git-dir=$HOME/dotfiles --work-tree=$HOME"' >> ~/.bashrc;
source ~/.bashrc;
bare config --local status.showUntrackedFiles no;
@shreewatsa
shreewatsa / markdown.md
Created July 15, 2023 09:59
Markdown Cheatsheet

Markdown Cheat Sheet

Reference The Markdown Guide.

This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements. It can’t cover every edge case, so if you need more information about any of these elements, refer to the reference guides for basic syntax and extended syntax.

Basic Syntax

These are the elements outlined in John Gruber’s original design document. All Markdown applications support these elements.

@shreewatsa
shreewatsa / password_policy.md
Created July 13, 2023 08:08
Change password policy in linux

Change this file : /etc/pam.d/common-password

password    [success=1 default=ignore]  pam_unix.so minlen=1 sha512
password    requisite           pam_deny.so
password    required            pam_permit.so
password    optional    pam_gnome_keyring.so
@shreewatsa
shreewatsa / README.md
Created July 7, 2023 00:52
How to profile python applications ?

Profiling Python applications.

  1. Profiling time (time complexity) : Scalene, Yappi, pprofile, Snakeviz, Pyinstrument, py-spy, etc.
  2. Profiling memory (space complexity) : memory_profiler, guppy/hpy, tracemalloc, Scalene, Pympler, etc.
@shreewatsa
shreewatsa / tools.sh
Last active July 4, 2023 11:27
Install softwares in remote machine
# Install fzf (fuzzy finder)
$curl -O https://github.com/junegunn/fzf/releases/download/0.41.1/fzf-0.41.1-linux_amd64.tar.gz;
# $wget https://github.com/junegunn/fzf/releases/download/0.41.1/fzf-0.41.1-linux_amd64.tar.gz;
$scp ./fzf* vm:/path/in/remote;
$tar -xvzf fzf-0.41.1-linux_amd64.tar.gz
$mv ./fzf /usr/local/bin/
@shreewatsa
shreewatsa / README.md
Last active May 26, 2023 00:53
Competitive Programming Gist

Use the GNU version of gcc instead of the Clang version.

$ g++ --version;
$ brew install gcc;
$ cd /usr/local/bin; ls;
$ g++-13 --version;

Make alias to GNU version of gcc OR Create symlink.

$ echo 'alias gcc="/usr/local/bin/gcc-13"' >> ~/.zshrc;
$ echo 'alias g++="/usr/local/bin/g++-13"' >> ~/.zshrc;

@shreewatsa
shreewatsa / bash_strict_mode.md
Created March 15, 2023 08:18 — forked from vncsna/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@shreewatsa
shreewatsa / skhd_config.md
Last active March 15, 2023 07:44
MacOS: skhd configuration file aka skhdrc

skhd config file location: ~/.config/skhd/skhdrc

Thinking behind these shortcuts:
Use 'cmd' key for all desktop,window,space related shortcuts. Here, cmd+alt is preferred to cmd+shift.
Use 'alt' key for all tmux related shortcuts.
Use 'ctrl', and leader key 'space' for vim related shortcuts.

Note: Most of the following shortcuts are configured for yabai.

#!/usr/bin/env sh
@shreewatsa
shreewatsa / yabai_config.md
Created March 15, 2023 07:25
MacOS: Yabai Configuration File aka yabairc

Config File Location: ~/.config/yabai/yabairc

#!/usr/bin/env sh

yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
sudo yabai --load-sa


# global settings
yabai -m config mouse_follows_focus          off
@shreewatsa
shreewatsa / macos_cheatsheet.md
Created March 15, 2023 04:46
MacOS Cheatsheet

Clear MAC password policies:

$ pwpolicy -clearaccountpolicies;