Skip to content

Instantly share code, notes, and snippets.

View 25b3nk's full-sized avatar
👨‍💻

25b3nk

👨‍💻
View GitHub Profile
@25b3nk
25b3nk / IndianIncomeTaxCalculations.gs
Created September 3, 2021 10:35
Google sheets' App script to calculate income tax according to Indian new tax regime
// Calculate Income tax based on new regime
function incomeAfterNewTaxDeductions(CTC) {
var initCostToCompany = CTC
var costToCompany = CTC
var totalTax = 0.0
var new_tax_regime = {
1500000: 0.30,
1250000: 0.25,
1000000: 0.20,
@25b3nk
25b3nk / simple_log.cpp
Last active April 17, 2024 12:17
C/C++ - printf() wrapper in macro
#include <stdio.h>
#define GET_MACRO(_1,_2,NAME,...) NAME
/**
* @brief Info logs
*
*/
// prints date, time, tag name, INFO in bold green color before actual message
#define LOGI2(tag, ...) printf("%s %s [%s]", __DATE__, __TIME__, tag); printf(" \033[1;32mINFO\033[0m "); printf(__VA_ARGS__); fflush(stdout);
@25b3nk
25b3nk / animate_in_gimp.md
Last active May 28, 2021 16:24
Create animated optical illusion in GIMP

Steps to create animated optical illusion in GIMP

Step 1

Create a new file of width: 960px and height: 600px, background color as white.

Step 2

Create a new layer and draw a solid circle (frame 1), then duplicate it to next layer and move the circle right by 40 pixels. Repeat till you have 6 frames (frame 1 to frame 6). These frames are our subjects.

Step 3

@25b3nk
25b3nk / dictionary_to_object.py
Last active May 20, 2021 06:57
This class, converts nested python dictionary to object. Stackoverflow answer link: https://stackoverflow.com/a/67608295/5258060
class Dict2Obj:
def __init__(self, json_data):
self.convert(json_data)
def convert(self, json_data):
if not isinstance(json_data, dict):
return
for key in json_data:
if not isinstance(json_data[key], dict):
self.__dict__.update({key: json_data[key]})
@25b3nk
25b3nk / install_pytorch_rpi.md
Last active March 22, 2019 12:01
Installing PyTorch on Raspberry Pi 3B+

First of all we will upgrade and update the packages

sudo apt update && sudo apt upgrade
sudo apt install vim

Add extra SWAP memory: If you don’t want to get ‘Memory exhausted’ or ‘Cannot Allocate Memory’, increase you swap memory.

sudo dd if=/dev/zero of=/swap1 bs=1M count=2048
sudo mkswap /swap1
@25b3nk
25b3nk / mount_ssd.md
Last active February 12, 2019 10:12
Mounting new SSD and creating swap

Creating the disk

$ sudo fdisk /dev/sda

After the above step you will get output which requires user inputs

Follow this link for more help: Link

$ sudo mkfs -t ext4 /dev/sda1
$ sudo mount /dev/sda1 /media/SSD_120/
$ sudo blkid | grep /dev/sda1 # To get the UUID of the disk
@25b3nk
25b3nk / install_pytorch.sh
Last active November 5, 2018 09:49
Installing PyTorch on Jetson-TX2 for Python2.7
# First of all install python pip
sudo apt-get install python-pip
# Upgrading pip using `pip install -U pip` gave me errors after,
# so I will be avoiding that.
# Clone pytorch repo
git clone http://github.com/pytorch/pytorch
# Enter the folder
@25b3nk
25b3nk / tf-r1.9-installation-steps.md
Last active July 31, 2018 06:15
Tensorflow installation on local PC; Ubuntu 16.04; NVIDIA GTX 1050 Ti; CUDA 9.0; GCC 5.4;

Building tensorflow from source on Ubuntu 16.04 with Cuda 9.1, 9.0 & 8.0 installed.

Will be trying to install tf-r1.9 with cuda 9.0

Following this link
I already have NVIDIA drivers and CUDA installed. Won't be explaining them here.
Steps:

  1. $ git clone https://github.com/tensorflow/tensorflow
  2. $ cd tensorflow
  3. $ git checkout
  4. You need to install bazel. Follow these instructions
@25b3nk
25b3nk / snake.py
Created August 1, 2016 16:50 — forked from sanchitgangwar/snake.py
Snakes Game using Python
# SNAKES GAME
# Use ARROW KEYS to play, SPACE BAR for pausing/resuming and Esc Key for exiting
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN
from random import randint
curses.initscr()
win = curses.newwin(20, 60, 0, 0)