Skip to content

Instantly share code, notes, and snippets.

View nitheeshkl's full-sized avatar

Nitheesh nitheeshkl

View GitHub Profile
@nitheeshkl
nitheeshkl / get_gpu_name.py
Created September 27, 2023 19:24
Get Nvidia GPU Name
from platform import machine
from re import sub as re_sub
from logging import getLogger
logger = getLogger(__name__)
__all__ = ["get_gpu_name"]
@nitheeshkl
nitheeshkl / gitconfig
Created June 1, 2022 23:24
gitconfig
[user]
name = Nitheesh K L
email = nitheeshkl@gmail.com
# color {{{
[color]
branch = auto
diff = auto
status = auto
ui = true
@nitheeshkl
nitheeshkl / tmux.conf
Created June 1, 2022 23:22
Tmux config for Mac iTerm2
# ~/.tmux.conf - tmux terminal multiplexer config
#
# echo 'tmux new -d -t default' >> .xinitrc
#Then bind "urxvt -e bash -c 'tmux attach -d -t default'"
#to any keycode :-)
#
# thanks
# - Han Boetes
# - Nicholas Marriott
# - Thayer Williams
@nitheeshkl
nitheeshkl / load_model.py
Created April 21, 2022 01:07
Pytorch3d Load model
DATA_DIR = "dataset/"
model_file = "03001627/8d458ab12073c371caa2c06fded3ca21"
obj_file = os.path.join(
DATA_DIR, "ShapeNetCore.v2", model_file, "models/model_normalized.obj"
)
mesh = load_objs_as_meshes([obj_file], device=device)
# We scale normalize and center the target mesh to fit in a sphere of radius 1
# centered at (0,0,0). (scale, center) will be used to bring the predicted mesh
# to its original center and scale. Note that normalizing the target mesh,
@nitheeshkl
nitheeshkl / gst_bash_completion.md
Last active July 15, 2020 14:38
Bash completion for Gstreamer

Gstreamer Bash Completion

Bash completion or tab completion is the capability of the shell (bash in this case) to be able to autocomplete words for commands, parameters, etc. on hitting the tab key.

Bash completion for Gstreamer is the capability for gst-launch and gst-inspect to autocomplete elements and their corresponding pads and parameters. For example, gst-inspect-1.0 v4l2<tab> will show all the list of available elements (plugins) in the systems that start with v4l2.

@nitheeshkl
nitheeshkl / gige_gst_v4l.md
Last active May 2, 2024 08:02
Gstreamer pipelines to use GigE cams as webcam for Zoom/Teams/Skype

Using GigE cam as webcam for Zoom/Skype/Teams

TL;DR: Creates a Gstreamer pipeline to read camera frames from a GigE camera, using Aravis library, and publish them as V4l2 camera source, using V4l2loopback, that can be read by video conferencing programs like Zoom/Skype/Teams.

gst-launch-1.0 aravissrc blocksize=5013504 h-binning=1 v-binning=1 ! video/x-bayer,format=rggb,framerate=100/5,width=2448,height=2048 ! bayer2rgb ! video/x-raw,format=RGBx ! videoconvert ! video/x-raw,format=YUY2 !  aspectratiocrop aspect-ratio=16/9 ! videoscale ! video/x-raw,width=1280,height=720 ! queue ! v4l2sink device=/dev/video0

The Basics

@nitheeshkl
nitheeshkl / 60-keylock.rules
Created January 21, 2018 07:37
linux keylock
# /etc/udev/rules.d/60-keylock.rules
#ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="090c", ATTRS{idProduct}=="1000", ATTRS{serial}=="B1301100000946", SYMLINK+="keylock", RUN+="/lib/udev/keylock $env{ACTION}"
ACTION=="add", SUBSYSTEM=="usb", ENV{ID_VENDOR}=="090c", ENV{ID_MODEL}=="1000", ENV{ID_SERIAL_SHORT}=="B1301100000946",SYMLINK+="keylock", RUN+="/lib/udev/keylock $env{ACTION}"
ACTION=="remove", SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="090c", ENV{ID_MODEL}=="1000", RUN+="/lib/udev/keylock $env{ACTION}"
@nitheeshkl
nitheeshkl / serialwrite.c
Last active July 15, 2020 14:42
serial port write in c
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <stdlib.h> /* Int to string conversion */
int open_port(char *port)
@nitheeshkl
nitheeshkl / xscreensaver_watch.sh
Last active July 15, 2020 14:43
watch xscreensaver for lock and unlock
#!/bin/sh
# Watch xscreensaver and react to status changes.
#
# Replaced my previous perl-based recipe with this:
# http://semicomplete.googlecode.com/svn/tools/xscreensaver-watch.sh
#
# Include somewhere in X session startup with:
#
# xscreensaver-watch &
@nitheeshkl
nitheeshkl / notify.sh
Last active July 15, 2020 14:43
display notifications in linux
#!/bin/sh
user=`whoami`
#pids=`pgrep -u $user gnome-panel`
pids=`pgrep -u $user wingpanel`
title=$1
text=$2
timeout=$3
icon=$4
if [ -z "$title" ]; then