Skip to content

Instantly share code, notes, and snippets.

View andrewjong's full-sized avatar
🔥
Robotics and AI

Andrew Jong andrewjong

🔥
Robotics and AI
View GitHub Profile
@andrewjong
andrewjong / cron-prog
Created November 27, 2020 16:18
Allows "notify-send" to be run by cron to show up for the user.
#!/bin/sh
# Executes a program as the currently logged in user. e.g. in /etc/crontab:
# */5 22 * * * root cron-prog notify-send "Closing computer now!"
[ "$#" -lt 1 ] && echo "Usage: $0 program options" && exit 1
program="$1"
shift
user=$(whoami)
#!/bin/bash
# from https://github.com/giswqs/manjaro-linux/blob/master/08-input-methods
echo "Installing input methods ..."
pkgs="adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts fcitx kcm-fcitx fcitx-gtk2 fcitx-gtk3 fcitx-qt4 fcitx-qt5 fcitx-ui-light fcitx-table-other"
echo $pkgs
trizen -S $pkgs --noconfirm
@andrewjong
andrewjong / pytorch_image_folder_with_file_paths.py
Last active October 31, 2024 11:13
PyTorch Image File Paths With Dataset Dataloader
import torch
from torchvision import datasets
class ImageFolderWithPaths(datasets.ImageFolder):
"""Custom dataset that includes image file paths. Extends
torchvision.datasets.ImageFolder
"""
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):
@andrewjong
andrewjong / example.sh
Created November 14, 2017 22:20
Log output to file bash
# Logs stdout and stderr
logFile='ask_reboot_log.txt'
exec > >(tee -ia $logFile)
exec 2> >(tee -ia $logFile >&2)
echo 'Hello'
echo 'error output' >&2
# https://stackoverflow.com/questions/3173131/redirect-copy-of-stdout-to-log-file-from-within-bash-script-itself
@andrewjong
andrewjong / .vimrc
Last active November 9, 2022 17:19
My vim configuration file
""" =====VIM-PLUG=====
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
@andrewjong
andrewjong / atom-sane-tab-switching.cson
Last active December 31, 2016 06:34 — forked from thunsaker/atom-sane-tab-switching.cson
Atom - Sane Tab Switching
# Add the following to your keymap.cson file for traditional LTR style tab-switching instead of Atom's default MRU style.
#
# Get to keymap.cson through Settings -> Keybindings or ~/.atom/keymap.cson (on Mac)
'body':
'ctrl-tab ^ctrl': 'unset!'
'ctrl-tab': 'pane:show-next-item'
'ctrl-shift-tab ^ctrl': 'unset!'
'ctrl-shift-tab': 'pane:show-previous-item'