Skip to content

Instantly share code, notes, and snippets.

View gist:633e1cf1443fbef0b7b60cc4df3e5bbf
### Keybase proof
I hereby claim:
* I am imonroe on github.
* I am imonroe ( on keybase.
* I have a public key ASD8yUdUlLyYC3kCM_YZb0J0FPfcNYyzHIucefCQlJ188Qo
To claim this, I am signing this object:
imonroe /
Created Jul 15, 2018
Convert all the docx files in a directory to markdown, and concatenate
#!/usr/bin/env bash
find . -name "*.docx" | while read file; do
pandoc -s "$file" -t markdown -o "./converted/$"
cat ./converted/*.md > ./converted/
imonroe /
Last active Jul 28, 2018
Handy Git tricks
## discard modifications in a directory
git checkout -- Gemfile # reset specified path
git checkout -- lib bin # also works with multiple arguments
## Undo local commits
git reset HEAD~2 # undo last two commits, keep changes
git reset --hard HEAD~2 # undo last two commits, discard changes
## Remove a file from the repo, but keep it in the filesystem
git reset filename # or git remove --cached filename
imonroe / drush_user_delete_example.php
Last active Dec 12, 2018
Drush - Delete a group of users in Drupal 7 from the command line
View drush_user_delete_example.php
// We want to preserve all accounts from a selection of email domains.
// We want to preserve system accounts with UIDs 0 and 1
// We want to delete all other accounts which are:
// - disabled, AND
// - have never been used, AND
// - have never been logged into
// We also want to use Drupal's user_delete_multiple() function so that
// all the necessary hooks are called throughout the system.
imonroe /
Created May 18, 2021
Disable the stupid bell sound in WSL
#!/usr/bin/env bash
echo "set bell-style none" >> ~/.inputrc