Skip to content

Instantly share code, notes, and snippets.

@nachocab
nachocab / instructions.sh
Last active February 13, 2022 15:45
How to make git diff work perfectly with .docx files in Mac OS X (it even colors by word)
# download docx2txt by Sandeep Kumar
wget -O docx2txt.pl http://www.cs.indiana.edu/~kinzler/home/binp/docx2txt
# make a wrapper
echo '#!/bin/bash
docx2txt.pl $1 -' > docx2txt
chmod +x docx2txt
# make sure docx2txt.pl and docx2txt are your current PATH. Here's a guide
http://shapeshed.com/using_custom_shell_scripts_on_osx_or_linux/
@mbostock
mbostock / .block
Last active June 27, 2025 20:50
Save SVG as PNG
license: gpl-3.0
@tmplinshi
tmplinshi / KeypressOSD.ahk
Last active February 16, 2024 12:55
Note: This script has been moved to https://github.com/tmplinshi/KeypressOSD
; KeypressOSD.ahk
;--------------------------------------------------------------------------------------------------------------------------
; ChangeLog : v2.22 (2017-02-25) - Now pressing same combination keys continuously more than 2 times,
; for example press Ctrl+V 3 times, will displayed as "Ctrl + v (3)"
; v2.21 (2017-02-24) - Fixed LWin/RWin not poping up start menu
; v2.20 (2017-02-24) - Added displaying continuous-pressed combination keys.
; e.g.: With CTRL key held down, pressing K and U continuously will shown as "Ctrl + k, u"
; v2.10 (2017-01-22) - Added ShowStickyModKeyCount option
; v2.09 (2017-01-22) - Added ShowModifierKeyCount option
; v2.08 (2017-01-19) - Fixed a bug
@jordonbiondo
jordonbiondo / *scratch*.el
Last active May 25, 2018 12:14
Create an async.el-friendly lambda that uses variables and functions bound in the current emacs instance.
(defmacro value-bound-lambda (args symbols &rest body)
"Returns a lambda expression with ARGS, where each symbol in SYMBOLS is
available for use and is bound to it's value at creation.
Symbols needs to be a list of variables or functions available globally."
(declare (indent defun))
(let ((vars (remove-if-not 'boundp symbols))
(funcs (remove-if-not 'functionp symbols)))
`(lambda ,args
(let ,(mapcar (lambda (sym) (list sym (symbol-value sym))) vars)
@nauhygon
nauhygon / Build Emacs for Windows 64bit with Native Compilation.md
Last active June 30, 2025 02:21
Step-by-step instructions to build Emacs for Windows 64 bit with MSYS2 and MinGW-w64. Now `native-comp` supported.

Build Emacs-w64 with MSYS2/MinGW-w64 with Native Compilation

Instructions are modified from emacs-w64 Wiki page by zklhp. Many thanks for sharing!

  1. Download the latest MSYS2 from this download page.

  2. Install MSYS2 to, for example, C:\msys2 (make sure no space in path to avoid unwanted problems).

  3. Optionally prettify the MSYS2 console mintty with ~/.minttyrc to make it more pleasing to eyes. Thanks to this awesome theme!

@Zearin
Zearin / python_decorator_guide.md
Last active June 20, 2025 06:17
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@celadevra
celadevra / switch.el
Last active November 19, 2021 10:18
Sane switching of input methods when using evil-mode in Emacs on OSX
;; switch to english input method when switching to normal mode
;; and switch back when entering insert/replace modes
;; need external script support, currently mac-only
(defvar default-im "com.apple.keylayout.Dvorak" "Default ascii-only input method")
(defvar prev-im (substring (shell-command-to-string "~/bin/im-select") 0 -1)
"IM that I use when starting Emacs and exiting insert mode")
(defun im-use-dvorak ()
"Switch to Dvorak input method on a Mac. im-select is a tool
provided at http://git.io/ndA8Mw"
@AWMooreCO
AWMooreCO / AdvancedWindowSnap.ahk
Last active April 19, 2025 18:27
Advanced Window Snap is a script for AutoHotKey that expands upon Windows built-in window-snapping hotkeys.
/**
* Advanced Window Snap
* Snaps the Active Window to one of nine different window positions.
*
* @author Andrew Moore <[email protected]>
* @version 1.0
*/
/**
* SnapActiveWindow resizes and moves (snaps) the active window to a given position.
#!/usr/bin/env perl
=encoding UTF-8
This is a Pandoc <http://pandoc.org> filter to turn
code blocks and code spans which have certain specified
classes into RawBlock or RawInline elements in specified
output formats, wrapping them in specified markup as needed.
It can be used e.g. to output LaTeX math in both LaTeX and HTML,
@amroamroamro
amroamroamro / README.md
Last active February 24, 2025 18:17
[Python] Fitting plane/surface to a set of data points

Python version of the MATLAB code in this Stack Overflow post: https://stackoverflow.com/a/18648210/97160

The example shows how to determine the best-fit plane/surface (1st or higher order polynomial) over a set of three-dimensional points.

Implemented in Python + NumPy + SciPy + matplotlib.

quadratic_surface