This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am markrose on github. | |
* I am markrose (https://keybase.io/markrose) on keybase. | |
* I have a public key ASBwls4s0qiUunhReloVUOmQLK8Qw0J5EY2Mr9t0RrmQfwo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use a command like this to watch the number of matching lines in a log file | |
tail -f logfile | grep whatever | pv -lr 2>&1 >/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in $(find -name "*php" | sort) ; do php -l $i ; if [ $? -gt 0 ] ; then break ; fi ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Have to work with coders who use 4 spaces indentation instead of tabs? This is my shortcut to mending their ways. | |
for i in $(ls) ; do expand -t4 $i > $i.broken ; unexpand -t4 --first-only $i.broken > $i ; rm $i.broken ; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reuse an existing ssh-agent on login, or create a new one. Append this to your .bashrc | |
# I have no idea who the author of the original concept was for reusing agents. This | |
# version also handles the case where the agent exists but has no keys. | |
GOT_AGENT=0 | |
for FILE in $(find /tmp/ssh-* -type s -user ${LOGNAME} -name "agent.[0-9]*" 2>/dev/null) | |
do | |
SOCK_PID=${FILE##*.} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* I've yet to come across a fast way to merge sorted arrays by a user value. | |
* Merging the arrays and using PHP's usort isn't efficient, as it doesn't take | |
* advantage of the existing sorting. So I wrote my own merge sorted arrays by user | |
* value function. The limit parameter can be used be used to limit the number of | |
* results (there is no point sorting more results than needed). This sort is stable: | |
* values will be taken preferentially from the first, then second, etc., array | |
* inside $merge_arrays. |