Skip to content

Instantly share code, notes, and snippets.

View GustafB's full-sized avatar

Gustaf Brostedt GustafB

  • Saporo SA
  • Stockholm, Sweden
View GitHub Profile
@fufexan
fufexan / macos_accel.py
Created September 12, 2024 20:18
macOS-like acceleration curve for libinput
#!/usr/bin/env python3
# macOS-like pointer acceleration for libinput
# Author: fufexan <[email protected]>
# Uncomment matplotlib and the plot_curve definition and call to visualize the curve
# import matplotlib.pyplot as plt
import sys
import os
@shapr
shapr / org-idle-timer.el
Created November 4, 2021 22:17
show org-mode todo when emacs is idle
;; timer variable
(defvar idle-timer-show-org-agenda-timer nil)
;; start function
(defun se/idle-timer-show-org-agenda-start ()
(interactive)
(when (timerp idle-timer-show-org-agenda-timer)
(cancel-timer idle-timer-show-org-agenda-timer))
(setq idle-timer-show-org-agenda-timer
(run-with-idle-timer (* 10 60) 1 #'org-agenda-list)))
@cdepillabout
cdepillabout / shell.nix
Last active November 19, 2025 01:09
shell.nix for Python development using virtualenv and pip
let
nixpkgs-src = builtins.fetchTarball {
# master of 2021-01-05.
url = "https://github.com/NixOS/nixpkgs/archive/1a57d96edd156958b12782e8c8b6a374142a7248.tar.gz";
sha256 = "1qdh457apmw2yxbpi1biwl5x5ygaw158ppff4al8rx7gncgl10rd";
};
pkgs = import nixpkgs-src {
config = {
# allowUnfree may be necessary for some packages, but in general you should not need it.
@joshschmelzle
joshschmelzle / remap-capslock-to-control-win10.md
Last active October 19, 2025 20:02
Remap Caps Lock to Control on Windows 10

Ways to remap caps lock to control on Windows 10

These methods in this gist worked for me on my U.S.-based keyboard layouts. I am unsure about other layouts. If you have problems, revert your changes; delete the registry key you created (and reboot).

Update: you should probably scroll down to approach 4 where I suggest using Microsoft PowerToys Keyboard Manager.

Approach 1. Manually through regedit

Navigate to and create a new binary value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout named Scancode Map.

@jwreagor
jwreagor / EmacsKeyBinding.dict
Created March 20, 2014 18:41
Global Emacs Key Bindings for OS X
{
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
*
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
*
* BEWARE:
* This file uses the Option key as a meta key. This has the side-effect
* of overriding Mac OS keybindings for the option key, which generally
@sedm0784
sedm0784 / CapsLockCtrlEscape.ahk
Last active November 18, 2025 08:58
AutoHotkey script to map Caps Lock to Escape when it's pressed on its own and Ctrl when used in combination with another key, à la Steve Losh. Adapted from one that does something similar with the Ctrl Key on the Vim Tips Wiki (http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281). (Plus contribs from @randy909 & @mmikeww.)
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
}
@mattbierbaum
mattbierbaum / Makefile
Created September 4, 2011 19:44
SWIG with C++ class example
# standard compile options for the c++ executable
FLAGS = -fPIC
# the python interface through swig
PYTHONI = -I/usr/include/python2.6/
PYTHONL = -Xlinker -export-dynamic
# default super-target
all:
g++ -fPIC -c kitty.cc -o kitty.o