Skip to content

Instantly share code, notes, and snippets.

@et2010
et2010 / rename-org-link-file.el
Last active April 3, 2021 17:06
Rename the file that org-link pointed to and update the link
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
# Syntax: ./common-debian.sh <install zsh flag> <username> <user UID> <user GID>
set -e
@et2010
et2010 / multiple_ssh_setting.md
Created March 24, 2019 18:24 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@et2010
et2010 / Build Emacs for Windows 64bit.md
Created June 5, 2018 05:36 — forked from nauhygon/Build Emacs for Windows 64bit with Native Compilation.md
Step-by-step instructions to build Emacs for Windows 64 bit with MSYS2 and MinGW-w64.

Build Emacs-w64 with MSYS2/MinGW-w64

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

  1. Download MSYS2 (msys2-x86_64-20161025.exe) from this download page.

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

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

@et2010
et2010 / *scratch*.el
Created October 25, 2017 06:06 — forked from jordonbiondo/*scratch*.el
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)
@et2010
et2010 / aes_example_in_python.py
Created October 4, 2017 18:41 — forked from dokenzy/aes_example_in_python.py
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
@et2010
et2010 / fixup-join-lines-for-chinese.el
Created March 15, 2017 17:05
Remove needless whitespace when joining two lines in Chinese
(defun et/fixup-whitespace ()
"Fixup white space between objects around point.
Leave one space or none, according to the context."
(interactive "*")
(save-excursion
(delete-horizontal-space)
(if (or (looking-at "^\\|\\s)")
(save-excursion (forward-char -1)
;; we adapted the regexp here:
(looking-at "\\cc\\|$\\|\\s(\\|\\s'")))
@et2010
et2010 / packages.el
Created February 18, 2016 08:17
Untitled
(defun jw/gather-alist-cdrs (ALIST)
"Return a list whose elements are cdrs from ALIST"
(-mapcat (lambda (x) (list (cdr x))) ALIST))
@et2010
et2010 / packages.el
Created February 18, 2016 08:16
Untitled
(defmacro jw/concat-string-list (&rest strings)
"Concat all elements in LIST whose elements are all strings"
`(concat ,@strings))
@et2010
et2010 / volumeicon.sh
Created February 8, 2016 15:49
If there are problems running volumeicon, try:
rm -iv ~/.config/volumeicon/volumeicon