Skip to content

Instantly share code, notes, and snippets.

View neerajadsul's full-sized avatar

Neeraj Adsul neerajadsul

View GitHub Profile
@neerajadsul
neerajadsul / etc.fstab
Created May 10, 2024 14:43
SMB/NFS Automount in Ubuntu from Unraid Share
//SERVERNAME.local/SHARENAME /mnt/SHARENAME cifs username=user,password=PASSWORD,iocharset=utf8,rw,uid=1000,gid=1000,nounix,file_mode=0777,dir_mode=0777 0 0
@neerajadsul
neerajadsul / activate_env
Created April 9, 2024 15:45
Activate Python Virtual Environment from A Directory
# Put this in your .bashrc or .zshrc
# You can change the directory `virtualenvs` to whichever you prefer.
activate() {
source ~/.virtualenvs/"$1"/bin/activate
}
@neerajadsul
neerajadsul / smb_mount_unraid_share_ubuntu
Last active April 8, 2024 13:28
Fstab Config for Mounting SMB Share from Unraid to Ubuntu 22.04
//UNRAID.local/network_share /mnt/network_share cifs username=userK,password=guesswho,iocharset=utf8,rw,uid=1000,gid=1000,nounix,file_mode=0777,dir_mode=0777 0 0
# Hints from https://forums.unraid.net/topic/71986-solved-automounting-shares-in-linux-with-fstab-not-working/
# Once added `sudo umount /mnt/network_share` followed by `sudo mount /mnt/network_share'
# Also make sure to set read/write permission for `userK` in settings for the share
# This is using SMB in Private Mode
@neerajadsul
neerajadsul / diff_circuitpython.py
Created June 13, 2023 15:32
Find differences between packages in CircuitPython's Different Versions
# https://circuitpython.org/board/raspberry_pi_pico/
# CircuitPython 7.3.3 packages:
cp7 = "_bleio, adafruit_bus_device, adafruit_pixelbuf, aesio, alarm, analogio, atexit, audiobusio, audiocore, audiomixer, audiomp3, audiopwmio, binascii, bitbangio, bitmaptools, bitops, board, busio, countio, digitalio, displayio, errno, floppyio, fontio, framebufferio, getpass, gifio, imagecapture, json, keypad, math, microcontroller, msgpack, neopixel_write, nvm, onewireio, os, paralleldisplay, pulseio, pwmio, qrio, rainbowio, random, re, rgbmatrix, rotaryio, rtc, sdcardio, sharpdisplay, storage, struct, supervisor, synthio, terminalio, time, touchio, traceback, ulab, usb_cdc, usb_hid, usb_midi, vectorio, watchdog, zlib"
# CircuitPython 8.0.0-beta.6 packages:
cp8 = "_asyncio, _bleio, _pixelmap, adafruit_bus_device, adafruit_pixelbuf, aesio, alarm, analogbufio, analogio, array, atexit, audiobusio, audiocore, audiomixer, audiomp3, audiopwmio, binascii, bitbangio, bitmaptools, bitops, board, builtins, busio, collections, cou
@neerajadsul
neerajadsul / shell_aliases.sh
Last active September 22, 2023 10:29
Shell aliases and modifiers
# aliases for commonly used commands
alias ll="exa -al"
alias gad="git add"
alias gcm="git commit -m"
alias gst="git status"
alias gps="git push"
alias gpss="git push --set-upstream origin"
alias gol="git log"
alias gfa="git fetch --all"
alias gfp="git fetch --prune"
@neerajadsul
neerajadsul / show_object_bounding_box
Created April 19, 2023 12:10
Crop Bounding Box and Show Object Detection Result
def imshow_od_bbox(image_file, bbox_voc, object_class, labelmap_dict):
import matplotlib.pyplot as plt
from PIL import Image
xmin,ymin,xmax,ymax = bbox_voc
right = xmin + (xmax - xmin)
bottom = ymin + (ymax - ymin)
image = Image.open(image_file)
detected_object = image.crop((xmin, ymin, right, bottom))
@neerajadsul
neerajadsul / multiarray_columns_to_csv.py
Created March 4, 2023 10:37
Combine columns of NumPy array and write as CSV File
from sklearn.datasets import make_moons
X,y = make_moons(n_samples=200, noise=0.15)
with open('data.csv', 'w') as f:
wr = csv.writer(f, delimiter=',')
combined = np.column_stack((X,y))
wr.writerows(combined)