Skip to content

Instantly share code, notes, and snippets.

@agtbaskara
agtbaskara / docker_cheatsheet.md
Created November 18, 2023 02:24
Docker Cheatsheet

Using Docker

Before building the docker image go to the cloned whill-robot directory

cd ~/catkin_ws/src/whill-robot

Build Docker images

@agtbaskara
agtbaskara / verilog_tutorial.txt
Created August 14, 2023 21:16
verilog tutorial
My recommendation is to start with RTL basics in verilog using one of the online platforms.
https://hdlbits.01xz.net/wiki/Main_Page
https://chipdev.io/question-list
https://www.edaplayground.com/
And verilog docs:
@agtbaskara
agtbaskara / png_alpha_remove.txt
Last active November 18, 2023 02:25
Remove alpha channel from png file
mogrify -alpha off *.png
@agtbaskara
agtbaskara / generate_englighten.py
Created March 17, 2023 06:58
Enchance images in a directory using EnlightenGAN
import os
import cv2
from enlighten_inference import EnlightenOnnxModel
from tqdm import tqdm
# Set input and output path
input_path = 'image_rgb'
output_path = 'image_enlighten'
@agtbaskara
agtbaskara / rename.py
Created January 30, 2023 07:38
rename files in directory to orderly numbered filename
import os
import shutil
from tqdm import tqdm
from natsort import natsorted
if __name__ == '__main__':
dirlist = ['tut-sync/tut-ringroad/day/image_depth', 'tut-sync/tut-ringroad/night/image_depth',
'tut-sync/tut-backyard/day/image_depth', 'tut-sync/tut-backyard/night/image_depth']
@agtbaskara
agtbaskara / grayscale_resize.py
Created January 30, 2023 07:37
Convert and resize images in a directory into grayscale images compatible with seqslam program
import os
import argparse
import cv2
# Setup Argument Parser
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--image_dir', type=str, default='', help='input directory')
@agtbaskara
agtbaskara / README.md
Last active October 18, 2022 09:20
Run this python script to turn off MSI Mystic 1562 Keyboard RGB (https://gitlab.com/CalcProgrammer1/OpenRGB/-/issues/2289)

Place the python scripts on ~/.custom_scripts/msi-mystic-1562-rgb-off.py then add this to Ubuntu Startup to turnoff keyboard light at boot (change agtbaskara to your username)

Name:

msi-mystic-1562-rgb-off

Command:

@agtbaskara
agtbaskara / video.py
Created June 3, 2022 19:58
create synchronized video from dataset
import os
import cv2
import skvideo.io
import numpy as np
import pandas as pd
from tqdm import tqdm
if __name__ == '__main__':
reference_file_path = os.path.join('town07.csv')
@agtbaskara
agtbaskara / faiss_cosine.py
Last active May 10, 2022 03:07
FAISS Cosine similarity example
# Just adding example if noob like me came here to find how to calculate the Cosine similarity from scratch
# Source https://github.com/facebookresearch/faiss/issues/95
import faiss
dataSetI = [.1, .2, .3]
dataSetII = [.4, .5, .6]
#dataSetII = [.1, .2, .3]
x = np.array([dataSetI]).astype(np.float32)
@agtbaskara
agtbaskara / keychron_linux.md
Created February 4, 2022 11:48 — forked from andrebrait/keychron_linux.md
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work

Keychron Keyboards on Linux use the hid_apple driver (even in Windows/Android mode), both in Bluetooth and Wired modes. By default, this driver uses the F-keys as multimedia shortcuts and you have to press Fn + the key to get the usual F1 through F12 keys.