Skip to content

Instantly share code, notes, and snippets.

View andrewjong's full-sized avatar
Developing wildfire technology

Andrew Jong andrewjong

Developing wildfire technology
View GitHub Profile
andrewjong / cron-prog
Created November 27, 2020 16:18
Allows "notify-send" to be run by cron to show up for the user.
# 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
# from
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 /
Last active February 27, 2024 09:24
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
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):
andrewjong /
Created November 14, 2017 22:20
Log output to file bash
# Logs stdout and stderr
exec > >(tee -ia $logFile)
exec 2> >(tee -ia $logFile >&2)
echo 'Hello'
echo 'error output' >&2
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
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)
'ctrl-tab ^ctrl': 'unset!'
'ctrl-tab': 'pane:show-next-item'
'ctrl-shift-tab ^ctrl': 'unset!'
'ctrl-shift-tab': 'pane:show-previous-item'