Skip to content

Instantly share code, notes, and snippets.

@dokenzy
dokenzy / aes_example_in_python.py
Last active May 3, 2020 07:09
AES Encrytion Example in Python
#-*- coding: utf-8 -*-
# Python 3.4
# author: http://blog.dokenzy.com/
# date: 2015. 4. 8
# References
# http://www.imcore.net/encrypt-decrypt-aes256-c-objective-ios-iphone-ipad-php-java-android-perl-javascript/
# http://stackoverflow.com/questions/12562021/aes-decryption-padding-with-pkcs5-python
# http://stackoverflow.com/questions/12524994/encrypt-decrypt-using-pycrypto-aes-256
@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

#!/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,
@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.
@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"
@Zearin
Zearin / python_decorator_guide.md
Last active April 19, 2025 05:14
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].

@nauhygon
nauhygon / Build Emacs for Windows 64bit with Native Compilation.md
Last active March 4, 2025 23:14
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!

@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)
@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
@mbostock
mbostock / .block
Last active January 9, 2025 00:59
Save SVG as PNG
license: gpl-3.0