Skip to content

Instantly share code, notes, and snippets.

@gitanuj
gitanuj / RecursiveFileObserver.java
Created May 20, 2015 19:15
A FileObserver for Android which monitors all the files/folders in a directory recursively.
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import android.os.FileObserver;
/**
* A FileObserver that observes all the files/folders within given directory
* recursively. It automatically starts/stops monitoring new folders/files
@guilherme-miyake
guilherme-miyake / by_matching_positions.py
Last active October 22, 2025 09:16
Levenshtein Distance Options
# Refactor of: https://medium.com/@hebozhe/optimizing-levenshtein-distance-in-python-using-built-ins-only-8f6b37e9de89
def calculate_distance_to_last_position(matching_positions: list[tuple[int, int]]) -> int:
'''
summary: Calculate the minimum distance from (0, 0) to the end of
a list of Levenshtein coordinates.
params:
coords: list[tuple[int, int]] of (row, column) coordinates where
the characters of two strings were identical.
return: int of the Levenshtein distance.
@ThioJoe
ThioJoe / !AddCompressToMenu -- How-To-Use.txt
Last active October 22, 2025 09:13
Add "Compress To" Option to Old Windows 11 Start Menu - Registry Tweak
How To Use:
1. Choose which version you want to use:
- "Full Menu" Version: The same as the original one in the new context menu, and has multiple sub-menu items
- Other Version: Doesn't have a sub-menu, it just directly opens the "Create Archive" menu. (The equivalent of clicking the "Additional Options" sub-item in the original)
2. Double click the "Add_" reg file of whichever version you choose
3. Restart Windows Explorer
- You can restart it by opening Task Manager with Ctrl+Shift+Esc, then search it for "Windows Explorer", right click that and hit "Restart"
@jhale
jhale / README.md
Last active October 22, 2025 09:12
Spack against standard software set on uni.lu clusters

Spack for FEniCS on University of Luxembourg clusters

This should also be useful for other clusters where you want to use components (e.g. MPI, compilers) from the module system.

Setting up Spack

Start a session for building

si -N 1 -n 16 -c 1 -t 0-02:00:00 # on iris: -C broadwell or -C skylake

@notpushkin
notpushkin / zheses.json
Created September 19, 2017 18:37
Какой ЖЭС обслуживает ваш дом в Минске
{
"1": [],
"2": [],
"3": [
"ул. Азгура - 1",
"ул. Азгура - 1а",
"ул. Азгура - 1б",
"ул. Азгура - 3",
"ул. Азгура - 5",
"ул. Андреевская - 7/2",
- name: Overprovision like the pros'
hosts: all
tasks:
- name: Install early OOM killer and zram
ansible.builtin.apt:
pkg:
- earlyoom
- zram-tools
- name: Configure early OOM killer
ansible.builtin.lineinfile:
@butlerblog
butlerblog / functions.php
Last active October 22, 2025 09:02
SMTP using wp-config.php for settings #smtp #wp_mail
<?php // Don't use this line.
/*
* Add the script below to wherever you store custom code snippets
* in your site, whether that's your child theme's functions.php,
* a custom plugin file, or through a code snippet plugin.
*/
/**
* This function will connect wp_mail to your authenticated
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active October 22, 2025 09:02
Conventional Commits Cheatsheet