Skip to content

Instantly share code, notes, and snippets.

@leminhtr
leminhtr / autocomplete_windows_triple_press.ahk
Created June 5, 2024 16:00
double/triple caps to pick autocomplete option (Windows)
$CapsLock::
if winc_presses > 0 ; SetTimer already started, so log keypress instead
{
winc_presses += 1
Return
}
; Else, this is first press of a new series. Set count to 1 and start timer
winc_presses = 1
SetTimer, CapsLock, 600 ; Wait for more presses. 400 ms is too short
Return
@leminhtr
leminhtr / linux_machine_learning_setup_from_scratch.md
Last active June 4, 2024 10:22
Linux python setup for machine learning from scratch

LINUX ENVIRONMENT SETUP FROM SCRATCH (~40mn)

I. Linux environment

Setup folder structure

cd && mkdir -p dev/repositories &&
cd && mkdir Downloads &&
cd && mkdir Shares;
cd && mkdir -p dev/binaries;
@leminhtr
leminhtr / install_sty_ctan_latex_from_url.sh
Created November 8, 2022 19:09
Helper functions to fetch latex package from CTAN with either wget or git clone then install them on Ubuntu
export LATEX_STY_INSTALL_PATH="/usr/share/texmf/tex/latex/"
function install_sty_wget_ctan_latex() {
mkdir -p /tmp/sty/ &&
cd /tmp/sty/ &&
wget "$1" &&
unzip $(basename "$1") &&
folder_name="$(ls -t | tail -1)"
echo "mv $folder_name $LATEX_STY_INSTALL_PATH" &&
sudo mv $folder_name $LATEX_STY_INSTALL_PATH &&
@leminhtr
leminhtr / python-tensorflow-pytorch-GPU-nvidia-cuda-linux-clean-install-instructions.md
Last active November 17, 2024 23:39
Clean Python Deep Learning GPU setup with TensorFlow 2.X.X & PyTorch 1.X and GPU installation instructions for Ubuntu 20.04 - CUDA 11.X

Instructions

I. Clean Python setup from scratch. (~1h) Skip if you already have a python environment setup or want to use your own python virtualenv setup

0. Pre-install (skip if already done)

sudo apt-get install python3-pip python-dev
#!/bin/bash
#
# Remove desktop entry
MENU_DESKTOP_FOLDER='.local/share/applications'
echo $MENU_DESKTOP_FOLDER
DESKTOP_ENTRY_FILENAME='zotero-eap.desktop'
echo "Do you want to remove desktop entry: $DESKTOP_ENTRY_FILENAME in folder $MENU_DESKTOP_FOLDER ?"
.nparray : To np.array
ANY → np.array($expr$)
.list : To list
ANY → list($expr$)
.type : Type value
ANY → type($expr$)
topic_map_xml_grammar = r"""
start: topic_map_xml
topic_map_xml: XML_DEF topic_map
XML_DEF: "<?xml version="1.0" encoding="UTF-8"?>"
topic_map: OPENTOPICMAPTAG PREDEFINEDTOPIC topic* PREDEFINEDASSOCIATION association* CLOSETOPICMAPTAG
OPENTOPICMAPTAG: "{{opentopicmaptag}}"
PREDEFINEDTOPIC: "{{predefinedtopic}}"
topic: open_topic_tag subject_locator_tag subject_identifier_tag instance_of_tag name_tag occurrence_tag* CLOSETOPICTAG
open_topic_tag: TOPICTAG id_attrib ">"
TOPICTAG: "<topic "
# Dependencies : apt-fast to speed up.
# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-fast update -y
sudo apt-fast install google-chrome-stable -y
@leminhtr
leminhtr / always-on-top.sh
Created March 30, 2018 16:10
Add custom shortcut for putting active windows on top
# Install package to make windows always on top :
sudo apt-fast install -y wmctrl
# Set this command in shortcut settings to ctrl+space
wmctrl -r :ACTIVE: -b toggle,above