Skip to content

Instantly share code, notes, and snippets.

@apfelchips
apfelchips / aliexpress_en.js
Last active May 21, 2025 23:57
userscript that forces aliexpress.com to be in english
// ==UserScript==
// @name aliexpress_en
// @version 0.2
// @description always redirect to aliexpress.com and reset the location/language/currency settings. This script pins locale settings cookie. Please clear cookies on all "aliexpress" domains before using this userscript.
// @author @attero@mastodon.social
// @match *://www.aliexpress.com/*
// @match *://*.aliexpress.com/*
// @match *://www.aliexpress.ru/*
// @match *://*.aliexpress.ru/*
// @noframes
@apfelchips
apfelchips / me.user.keyremaps.plist
Created April 21, 2025 19:18
macOS US layout fix tick location on ISO Keyboards + Capslock --> LCtrl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>__Comment</key>
<string>Remap CapsLock with LCtrl and swap § with tick quote on ISO keyboards - https://apple.stackexchange.com/a/374074</string>
<key>__Install_Location</key>
<string>/Library/LaunchDaemons/ / owner: root group: wheel</string>
@apfelchips
apfelchips / Profile.ps1
Last active April 13, 2025 16:14
my crossplatform PowerShell Profile
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# src: https://gist.github.com/apfelchips/62a71500a0f044477698da71634ab87b
# New-Item $(Split-Path "$($PROFILE.CurrentUserCurrentHost)") -ItemType Directory -ea 0; Invoke-WebRequest -Uri "https://git.io/JYZTu" -OutFile "$($PROFILE.CurrentUserCurrentHost)"
# ref: https://devblogs.microsoft.com/powershell/optimizing-your-profile/#measure-script
# ref: Powershell $? https://stackoverflow.com/a/55362991
# ref: Write-* https://stackoverflow.com/a/38527767
# Write-Host wrapper for Write-Information -InformationAction Continue
@apfelchips
apfelchips / macOS-shortcuts.ahk
Last active February 17, 2025 17:36
First remap modifier keys with sharpkeys; AHK script has to run as Administrator to work on System Windows / Apps running as Administrator; see Watchdog ScheduledTask below, when you do this make sure to remove the inherited file permissions from C:/tools and only allow administrators write access.
#SingleInstance force
;#Persistent https://www.autohotkey.com/docs/commands/_Persistent.htm
;#InstallKeybdHook ; see: https://www.autohotkey.com/docs/v1/lib/_HotkeyModifierTimeout.htm
;#NoTrayIcon
TraySetIcon("accessibilitycpl.dll","6") ; Keyboard Icon
SetWorkingDir(A_ScriptDir) ; Ensures a consistent starting directory.
; Debugging
; #Warn All, OutputDebug ; Show Warnings in DebugView ( https://learn.microsoft.com/en-us/sysinternals/downloads/debugview )
@apfelchips
apfelchips / defaults.duti
Last active February 7, 2025 22:49
set file-associations on macOS: ~ 🥖.config 🥖duti 🥖defaults.duti
# duti settings file
# src: https://gist.github.com/apfelchips/0073cb3e8d186115f590d318998c1025
# mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/duti/" && curl -L "https://git.io/JRtzH" -o "${XDG_CONFIG_HOME:-$HOME/.config}/duti/default.duti"
# duti-apply wrapper: alias duti-apply='duti -v "${XDG_CONFIG_HOME:-$HOME/.config}/duti"'
## duti documentation http://duti.org/documentation.html
## see also: https://github.com/Lord-Kamina/SwiftDefaultApps#readme
# List of MIME Types:
@apfelchips
apfelchips / _bash_script_template.sh
Last active September 2, 2024 19:25
BASH helpers / backports / shims
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
SCRIPT_DIR=$(realpath -- $(dirname -- $0))
SCRIPT_NAME=$(basename "$0")
#SCRIPT_TMP=$(mktemp -d "${TMPDIR:-/tmp}/${SCRIPT_NAME}_XXXXXXX")
SCRIPT_VERSION='0.0.1'
VERBOSITY=0
TARGET_USER=
@apfelchips
apfelchips / .stignore_synced
Last active August 21, 2024 13:22
Backup / Sync exclusion patterns
// https://docs.syncthing.net/users/ignoring
// (?d) prefix to allow deletion of ignored files
// (?i) prefix makes the matching case insensitive
// echo #include .stignore_synced >> .stignore
(?d)(?i).Trash
(?d).DS_Store
._*
(?d)(?i)Thumbs.db
@apfelchips
apfelchips / choco_install.ps1
Last active April 18, 2024 18:01
chocolatey package install script
# allow running: Set-ExecutionPolicy Bypass -Scope Process -Force
# src: https://gist.github.com/apfelchips/792f7708d0adff7785004e9855794bc0
# goal: install all basic tools / pin software with working autoupdate mechanism / specialized stuff is commented out
# misc: Windows Store .appx downloader https://store.rg-adguard.net/
# Check Permissions
if ( -Not( (New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) ){
Write-Error -Message "Script needs Administrator permissions"
@apfelchips
apfelchips / user.js
Last active February 26, 2024 04:21
~ 🥖.config🥖firefox🥖Profiles🥖profile.default🥖user.js
// src: https://gist.github.com/apfelchips/f129c8316055e524774d757365267e26
// goal: disable all annoying stuff from firefox and tighten security, but still retain all modern web features
// configure as little as possible to benefit from changeing/hardened defaults by Mozilla
// inspired by:
// https://github.com/pyllyukko/user.js/blob/master/user.js
// https://github.com/ghacksuserjs/ghacks-user.js/blob/master/user.js
// http://kb.mozillazine.org/About:config_entries
// https://gist.github.com/ruilapa/3207798
#!/usr/bin/env python3
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.pem with the following command:
# openssl req -new -x509 -keyout key.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:8443
import http.server