Skip to content

Instantly share code, notes, and snippets.

View cmaspi's full-sized avatar
💧
Idk, drink water ig?

cmaspi cmaspi

💧
Idk, drink water ig?
View GitHub Profile
@cmaspi
cmaspi / tictactoe.py
Last active February 12, 2022 17:03
This is a pythom implementation of tic tac toe.
import pygame
import numpy as np
import sys
# initializing
pygame.init()
gameover = False
# board initialization
board = np.zeros((3,3), dtype=int)
@cmaspi
cmaspi / FastIO.md
Last active January 26, 2024 19:19
This blog explains the usage of cin.tie, cout.tie, ios_base::sync_with_stdio

WTF is cin.tie(NULL) and ios_base::sync_with_stdio(false)?

Let's go over why it's useful in competitive programming first!

ios_base::sync_with_stdio(false);
cin.tie(NULL);

These commands are used to make things faster in c++!, but what do we mean by making "things faster"?
These commands only make the input, output faster in C++. Let's understand what each of these commands do.

@cmaspi
cmaspi / swapInPython.md
Last active May 15, 2022 14:24
swap in python
a,b = b,a

What does it actually do?
Well, it swaps a and b.. the question is how?

Order of Operations

Python evaluates expressions from left to right. Notice that while evaluating an assignment, the right-hand side is evaluated before the left-hand side.

In the above line of code, two new objects are created which are reference the same object as b, a respectively. Then, we assign them to a,b. The left side will get assigned first, that is a.

@cmaspi
cmaspi / fish_prompt.fish
Last active March 16, 2024 14:16
this is my fish prompt
function fish_prompt
set -l last_status $status
if not set -q VIRTUAL_ENV_DISABLE_PROMPT
set -g VIRTUAL_ENV_DISABLE_PROMPT true
end
set_color --bold yellow
printf '%s' $USER
set_color magenta
printf ' in '
@cmaspi
cmaspi / color.txt
Last active March 20, 2022 04:46
This is a list of few colors schemes that can be used in terminal
Black: \u001b[30m
Red: \u001b[31m
Green: \u001b[32m
Yellow: \u001b[33m
Blue: \u001b[34m
Magenta: \u001b[35m
Cyan: \u001b[36m
White: \u001b[37m
Bright Black: \u001b[30;1m
Bright Red: \u001b[31;1m
@cmaspi
cmaspi / pdf.fish
Created May 15, 2022 14:20
This is a function to compile pdflatex with bibtex using a simple fish function, the limitation is that the tex file should be named main.
function pdf --description "It compiles a latex document"
pdflatex main.tex
bibtex main.aux
pdflatex main.tex
pdflatex main.tex
end
sudo apt update
sudo apt upgrade
sudo apt install vim
sudo apt remove --purge thunderbird
sudo apt remove -y --purge aisleriot gnome-mines gnome-mahjongg
sudo apt autoremove
sudo apt install fish
chsh -s $(which fish)
@cmaspi
cmaspi / sync-notes.fish
Created January 5, 2023 07:21
sync notes in obsidian with github
function sync-notes
set curr_dir (pwd)
cd ~/Obsidian/Research-Summary/
git pull
git add .
git commit -m "$argv"
git push
cd $curr_dir
end
@cmaspi
cmaspi / autodelete.service
Created November 4, 2023 06:37
Auto delete files from mentioned directory after 7 days of inactivity
[Unit]
Description=Delete files in the autodelete directory
[Service]
ExecStart=fish /home/cmaspi/.config/fish/functions/autodelete.fish
[Install]
WantedBy=multi-user.target
@cmaspi
cmaspi / userChrome.css
Last active April 15, 2024 18:23
This file witll center the text in address bar of firefox
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
#urlbar-container {
text-align: center !important;
}