Skip to content

Instantly share code, notes, and snippets.

View niedzielski's full-sized avatar
🥨

stephen niedzielski

🥨
View GitHub Profile
@niedzielski
niedzielski / pretty-print-json.js
Last active July 3, 2023 03:27
Pretty print JSON bookmarklet.
javascript:(_ => {
const pre = document.querySelector('pre');
pre.innerHTML = JSON.stringify(JSON.parse(pre.innerHTML), null, 2);
})()
@niedzielski
niedzielski / pixelate.js
Last active June 17, 2020 12:40
Pixelate images bookmarklet; disables zoomed image smoothing.
javascript:(_ => {
const sheet = document.createElement('style');
sheet.innerHTML = 'img { image-rendering: pixelated; }';
document.head.appendChild(sheet);
for(let i = 0; i < frames.length; ++i) {
frames[i].document.head.appendChild(sheet);
}
})()
@niedzielski
niedzielski / blue-links.js
Last active December 26, 2017 20:05
Bookmarklet to force links to blue, visited links to purple.
@niedzielski
niedzielski / .inputrc_browser
Last active February 10, 2018 19:15
Walk the file directory stack like a browser with the alt + cursor keys.
"\e[1;3A": "pushd ..\n" # alt-up
"\e[1;3C": "pushd -0\n" # alt-right
"\e[1;3B": "popd\n" # alt-down
"\e[1;3D": "pushd +1\n" # alt-left
@niedzielski
niedzielski / .bashrc_clipboard.bash
Last active December 26, 2017 20:06
Seamlessly work across GUIs and command line with copy and paste.
# The clipboard provides a very convenient way to exchange data between
# different programs and is especially convenient for working with GUIs
# which can't use pipelines. Add the following function to your .zshrc /
# .bashrc:
cb() {
# OS X: pbcopy / pbpaste
# Cygwin: putclip / getclip
# Linux: xclip (and others)
if [[ ! -t 0 ]]
@niedzielski
niedzielski / .bashrc_file_manager.bash
Last active December 26, 2017 20:07
Open the file manager GUI from the command line.
# Open a file browser GUI in any directory. Add the following to your
# .bashrc:
case "$OSTYPE" in
cygwin) gui() { explorer "${1:-.}"; } ;;
linux-gnu) gui() { nautilus "${1:-.}"; } ;;
darwin*) gui() { open "${1:-.}"; } ;;
*) echo 'Unknown file manager.' >&2 ;;
esac
# Examples
@niedzielski
niedzielski / android-update-all.bash
Last active December 26, 2017 20:08
Install the entire Android SDK from the command line without interaction.
# not sure if i wrote this or not. a google search turns up similar results from:
# http://stackoverflow.com/a/30623864/970346
# https://gist.github.com/hardikdangar/67cb7dc1ad7812966a19
time expect -c "
set timeout -1;
spawn android update sdk -u -a
@niedzielski
niedzielski / delete-macos-transient-files.sh
Last active December 26, 2017 20:09
Delete macOS transient files (._* and .DS_Store).
find \( -name ._\* -o -name .DS_Store \) -type f -size -100k -delete
@niedzielski
niedzielski / highlight.sh
Last active December 26, 2017 20:09
Highlight words but don't omit nonmatching lines.
echo -e 'foo\n\bar\nbaz'|grep -E 'a|$'
@niedzielski
niedzielski / pipenv-install-requirements.sh
Last active September 24, 2017 02:37
pipenv install requirements.txt
# Fixed! https://github.com/kennethreitz/pipenv/issues/11#issuecomment-331073367
# https://docs.pipenv.org/en/latest/advanced.html#importing-from-requirements-txt
sed 's%#.*%%;/^\s*$/d' requirements.txt|xargs -rd\\n pipenv install