Skip to content

Instantly share code, notes, and snippets.

@mevanlc
mevanlc / cmdhere.reg
Last active May 8, 2019 22:20
Add "Cmd Here" context-menu entry to Windows Explorer. Mnemonic hotkey is spacebar.
View cmdhere.reg
Windows Registry Editor Version 5.00
; After right-clicking on a folder in Windows Explorer,
; you can press spacebar to immediately execute Cmd Here and open a cmd prompt.
[HKEY_CLASSES_ROOT\Folder\shell\cmdhere]
@="Cmd& Here"
; By using pushd, we are able to open a cmd prompt on \\network\shares as an automatically mapped temporary drive letter.
; Make sure to use the "exit" command to close the command prompt, to automatically unmap the temporary drive.
[HKEY_CLASSES_ROOT\Folder\shell\cmdhere\command]
@="cmd /k \"cls&pushd \"%l\"\""
@mevanlc
mevanlc / winrenice.py
Last active May 9, 2019 08:28
In liu of a 'renice' cmdline utility on Windows. Requires Python and the https://github.com/giampaolo/psutil library.
View winrenice.py
#!/usr/bin/env python
# Copyright (c) 2019, Giampaolo Rodola', Michael Clark. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# https://github.com/giampaolo/psutil/blob/master/LICENSE
"""
In liu of a 'renice' cmdline utility on Windows.
$ winrenice chrome.exe below
@mevanlc
mevanlc / gpg_agent_daemon_bashrc.sh
Last active May 8, 2019 16:10
Reusing gpg-agent across login sessions (bashrc) on a headless server
View gpg_agent_daemon_bashrc.sh
# Run:
# sudo apt-get install gnupg-agent
# sudo apt-get install pinentry-curses
# Edit:
# $HOME/.gnupg/gpg-agent.conf:
# pinentry-program /usr/bin/pinentry-curses
# default-cache-ttl 28800000
# max-cache-ttl 28800000
# Edit:
# $HOME/.subversion/config:
@mevanlc
mevanlc / search_and_replace.jse
Created May 15, 2018 22:07
Microsoft JScript - Search and replace in a text file using regex
View search_and_replace.jse
try
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var shell = new ActiveXObject("WScript.Shell");
var READ = 1, WRITE = 2, APPEND = 8;
var TEXT_DEFAULT = -2, TEXT_UNICODE = -1, TEXT_ANSI = 0;
var argc = WScript.Arguments.Count();
if (argc < 4)
{