Skip to content

Instantly share code, notes, and snippets.

@jadient
jadient / PastePlainText.ahk
Last active March 9, 2021 05:31
AutoHotKey script to paste text without formatting
; WindowsKey-V shortcut to paste text with no formatting
; (like Paste Special > Plain Text, but faster and works everywhere)
; for AutoHotKey
#v::
ClipSaved := ClipboardAll
tempClipboard = %clipboard%
Clipboard = %tempClipboard%
SendPlay ^v
Clipboard := ClipSaved
; add an arbitrary delay to increase reliability for certain apps
@jadient
jadient / qunit_test.html
Last active December 16, 2015 18:39
QUnit template
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/qunit/1.11.0/qunit.js"></script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/qunit/1.11.0/qunit.css">
<script src="yourJavascriptFile.js"></script>
<script src="yourTestScriptFile.js"></script>
</head>
@jadient
jadient / h2c.py
Last active January 4, 2016 01:59
import re
def replace_one_hex_with_chr(m):
return str(unichr(int(m.group()[1:], 16)))
def replace_hex_with_chr(s):
return re.sub(r'%[0-9A-Fa-f][0-9A-Fa-f]', replace_one_hex_with_chr, s)
if __name__ == '__main__':
import sys, os
@jadient
jadient / inputwrapper.py
Last active August 29, 2015 13:57
python wrapper: convert input source to line generator
"""
Convert an input source (file, string, or file descriptor)
into a generator that provides a line at a time.
Online challenges provide input on stdin, but for testing,
it can be useful to provide input via a file or a string.
This wrapper takes any of these formats and returns an
iterator that will provide the input a line at a time.
"""
def input_from_string(data):
@jadient
jadient / python-batchfile.bat
Last active June 21, 2024 08:48
Run python code directly from a batch file
@echo off & python -x "%~f0" %* & goto :eof
# ==========================================================
# one way to place python script in a batch file
# place python code below (no need for .py file)
# ==========================================================
import sys
print "Hello World!"
for i,a in enumerate(sys.argv):
@jadient
jadient / console.py
Created March 8, 2015 21:32
python open interactive console (for debugging) from Tomasz Ducin
"""
Console module provide `copen` method for opening interactive python shell in
the runtime.
http://sys-exit.blogspot.com/2013/12/python-open-interactive-console.html
Usage:
import console
console.copen(globals(), locals())
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Set-StartScreenOptions -EnableBootToDesktop -EnableDesktopBackgroundOnStart -EnableShowStartOnActiveScreen -EnableShowAppsViewOnStartScreen -EnableSearchEverywhereInAppsView -EnableListDesktopAppsFirst
Disable-UAC
cinst bitdefenderavfree
cinst googlechrome
cinst sublimetext3
cinst classic-shell
cinst sysinternals
@jadient
jadient / git config
Last active November 11, 2017 20:52
# use --global or --system options to specify other configuration locations
# -- global is per user, --system is for all users
git config status.showUntrackedFiles no
# https://chodounsky.net/2013/05/01/compare-files-with-git-diff-tool/
git config color.status.added "cyan normal bold"
git config color.status.changed "cyan normal bold"
git config color.status.untracked "cyan normal bold"
git config color.diff.old "red normal bold"
# with difftool, choose which files to diff
git difftool --dir-diff
@jadient
jadient / .emacs
Last active February 11, 2018 01:13
.emacs on windows
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.