This idea came from I am trying to access the local server inside a virtual machine from the browser on the host machine. Maybe you would ask why did I not use the Nat network port forwarding? The primary reason is that I want to keep my config files to be consistent for all machines. So I don’t need to change its contents when using those configs on virtual machines. *Click* Nice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This determines the style of line numbers in effect. If set to `nil', line | |
;; numbers are disabled. For relative line numbers, set this to `relative'. | |
(setq display-line-numbers-type 'absolute) | |
;; Auto-switch to relative line number if entering the visual mode | |
(add-hook! 'evil-visual-state-entry-hook #'menu-bar--display-line-numbers-mode-relative) | |
(add-hook! 'evil-visual-state-exit-hook #'menu-bar--display-line-numbers-mode-absolute) |
#+name: show-file-content
#+header: :exports none :tangle no :results value raw
#+header: :var path="./README.org" :var revision="HEAD"
#+header: :var start=1 :var end=-1
#+begin_src emacs-lisp
(substring
(shell-command-to-string
(format "git show %s:%s | sed -n '%d,%sp;d'"
revision
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
processExist(name) { | |
DetectHiddenWindows, On | |
existed := WinExist("ahk_exe" name) | |
DetectHiddenWindows, Off | |
Return existed | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function WhichCommand( | |
[String]$cmd | |
) { | |
try { | |
$Command = Get-Command -ErrorAction Stop $cmd | |
} | |
catch { | |
Write-Host -ForegroundColor Red ("{0} not found" -f $cmd) | |
Return | |
} |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
- There are always 24 hours in a day.
- February is always 28 days long.
- Any 24-hour period will always begin and end in the same day (or week, or month).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getUnicodeFromInputBox() | |
{ | |
Sleep, 10 | |
InputBox, Code, AutoHotkey, Enter the Unicode, , 320, 112 | |
Send, {U+%Code%} | |
} | |
; Binding to CapsLock+x | |
CapsLock & x::getUnicodeFromInputBox() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# 0. (Optional) Rename this script name to "proxy" | |
# 1. Replace the <protocol>, <ip> and <port> to the actual value of your proxy respectively. | |
# 2. Run this command `sudo chmod +x <path to proxy>` to make sure this script is executable. | |
# 3. Add this script path to the PATH environment variable. | |
# 4. Run your actual command like this: `proxy ping www.google.com`. | |
PROXY="<protocol>://<ip>:<port>" | |
export ALL_PROXY=$PROXY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debounceLeftClick() | |
{ | |
Sleep, 10 | |
if !GetKeyState("LButton", "P") | |
{ | |
n := 1 | |
BlockInput, On | |
Loop { | |
Sleep, 10 | |
if (n++ > 9) |