Skip to content

Instantly share code, notes, and snippets.

@guimondmm
guimondmm / findFacebookPosts.py
Created March 21, 2018 14:01
Find stubborn Facebook posts that won't delete from the Activity Log. Those posts might reappear on your Timeline if they are not fully deleted.
#!/usr/bin/env python3
## Find stubborn Facebook posts that won't delete from the Activity Log.
## Those posts might reappear on your Timeline if they are not fully deleted.
import http, json, sys, webbrowser
try:
import requests
except ImportError:
sys.exit("\x1b[1;33mPlease install the \"requests\" module using\n$ pip3 install requests\x1b[0m")
try:
@guimondmm
guimondmm / betterAPAfootcites.tex
Created November 24, 2018 01:52
Better footnote citations and text citations for biblatex-apa 7.7
% This code snippet patches bugs with \footcite(s) and \textcite(s) in biblatex-apa 7.7 <https://ctan.org/pkg/biblatex-apa>
% The biblatex-apa package is (c) 2018 Philip Kime, licensed under LPPL v1.3 <http://www.latex-project.org/lppl.txt>
% The default behaviour of \footcite is more akin to \cite than \textcite, and it looks jarring when the latter is also used.
% Additionally, biblatex-apa prints extraneous spaces, commas or semi-colons when using \textcites and \footcites.
% Just paste the following code in your preamble:
\DeclareAutoCiteCommand{footnote}[f]{\footcite}{\footcites}% allows the use of [autocite=footnote] (cf. biblatex doc 3.1.1)
\DeclareCiteCommand{\footcite}[\mkbibfootnote]% redefines \footcite to use textcite (i.e. year & postnote in parentheses)
{\renewcommand{\compcitedelim}{}% removes extraneous comma
\bibsentence\usebibmacro{cite:init}\usebibmacro{prenote}}
{\usebibmacro{citeindex}\usebibmacro{textcite}}{}
@guimondmm
guimondmm / noheadingrefsegment.tex
Last active November 25, 2018 15:05
Segmented bibliography with BibLaTeX and untitled sections (no heading)
% Untitled section (no heading, e.g., Introduction):
\makeatletter\def\@currentlabelname{Introduction}\makeatother\newrefsection%
% Result: the label "Introduction" is not printed in the text but appears in the segmented bibliography
% Regular section with a heading:
\section*{Heading}\newrefsection%
% Result: the label "Heading" is printed above the paragraph as usual and also appears in the bibliography.
% Towards the end of the document, to print the segmented bibliography:
\defbibheading{subbibliography}{%
@guimondmm
guimondmm / build-scummvm.bash
Last active October 25, 2019 06:59
Build ScummVM for Nintendo 3DS on macOS
#!/usr/bin/env bash
# Build ScummVM for Nintendo 3DS on macOS
set -e # exit on errors
sudo -K # reset sudo credentials
SCUMMVM_VERSION='v2.1.0' # tagged version of ScummVM (tested with v2.1.0)
FORMAT='cia' # 3dsx or cia
# (Un)comment the lines below to (de)select engines as needed
@guimondmm
guimondmm / ignoreCatalina.sh
Created February 2, 2020 21:59
Ignore upgrade to macOS 10.15 Catalina + dismiss notification badge and delete already downloaded files
# Ignore the upgrade and dismiss the notification badge
killall "System Preferences"
sudo softwareupdate --ignore "macOS Catalina"
defaults delete com.apple.preferences.softwareupdate LatestMajorOSSeenByUserBundleIdentifier
softwareupdate -l
# Check the size of the Updates folder
du -sh /Library/Updates/
# To reclaim some of that space, reboot into macOS Recovery (hold ⌘-R at boot)
@guimondmm
guimondmm / bartender4istatmenus6battery.sh
Last active May 31, 2022 22:02
Bartender 4 "show for update" trigger script for iStat Menus 6 battery icon (macOS 11 Big Sur)
pmset -g batt | grep -c "Now drawing from 'Battery Power'"
@guimondmm
guimondmm / jupyter-notebook.code-workspace
Created June 10, 2022 16:27
VS Code workspace template for Jupyter notebooks: a mix of "sane" defaults and personal preferences (edit as needed)
{
"folders": [
{
"path": "."
}
],
"settings": {
"editor.bracketPairColorization.enabled": false,
"editor.fontFamily": "Iosevka, Consolas, 'Courier New', monospace",
"editor.fontLigatures": true,
@guimondmm
guimondmm / Anaconda PowerShell Prompt in Windows Terminal settings.json
Last active November 12, 2024 12:53
Add an "Anaconda PowerShell Prompt" profile to Windows Terminal. Just paste it in your settings.json file.
{
"colorScheme": "Campbell",
"commandline": "pwsh.exe -ExecutionPolicy ByPass -NoExit -Command \"& '%USERPROFILE%\\anaconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate '%USERPROFILE%\\anaconda3' \"",
"guid": "{e7d34d61-5a57-4f38-8eab-91cb777b0c26}",
"hidden": false,
"icon": "%USERPROFILE%\\anaconda3\\Menu\\anaconda-navigator.ico",
"name": "Anaconda PowerShell Prompt",
"startingDirectory": "%USERPROFILE%"
}
@guimondmm
guimondmm / bartender4_heard.sh
Created September 25, 2023 22:19
Bartender 4 "show for update" trigger script for Background Sounds (macOS 13 Ventura or newer)
lsof -NPp $(pgrep -xo heard) 2>/dev/null | grep -cm1 com_apple_MobileAsset_ComfortSoundsAssets
{
"name": "Cobalt2",
"cursorColor": "#F4D300",
"selectionBackground": "#1F4562",
"background": "#173448",
"foreground": "#FFFFFF",
"black": "#000000",
"red": "#FF2600",
"green": "#3DDF2B",
"yellow": "#F4D300",