Skip to content

Instantly share code, notes, and snippets.

@mevanlc
mevanlc / install_z_sh.sh
Last active February 24, 2024 11:23
Helper script to install z.sh (jump around) - https://github.com/rupa/z
#!/bin/sh
SOURCE_URL="https://raw.githubusercontent.com/rupa/z/master/z.sh"
OUTPUT_LOC="$HOME/.z.sh"
usage_doc="Usage: $0 [-h] [-u url] [-o file]
-h this help
-u <url> download from <url>
default: $SOURCE_URL
-o <file> download to <file>
@mevanlc
mevanlc / cmdhere-undo.reg
Last active September 29, 2024 04:28
Add "Cmd Here" context-menu entry to Windows Explorer. Mnemonic hotkey is spacebar.
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Folder\shell\cmdhere]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\cmdhere]
@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.
#!/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
# 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
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)
{