Skip to content

Instantly share code, notes, and snippets.

View niedzielski's full-sized avatar
🥨

stephen niedzielski

🥨
View GitHub Profile
@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
@niedzielski
niedzielski / blue-links.js
Last active December 26, 2017 20:05
Bookmarklet to force links to blue, visited links to purple.
@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 / github-toggle-outdated.js
Last active December 26, 2017 20:10
Bookmarklet to toggle outdated GitHub pull request comment visibility.
javascript:(_ => { document.querySelectorAll('.show-outdated-button').forEach(button => button.click()) })()
@niedzielski
niedzielski / gerrit-toggle-comments.js
Last active December 26, 2017 20:11
Bookmarklet to toggle visibility of Gerrit comments.
javascript:(_ => {
document.querySelectorAll('.CodeMirror-linewidget')
.forEach(comment => comment.style.display = comment.style.display === 'none' ? '' : 'none')
})()
@niedzielski
niedzielski / npm-rebase.sh
Last active December 26, 2017 20:12
Rebase an npm repo and test each unmerged commit.
git rebase -x 'npm -s t' origin/master