This file contains hidden or 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
if command -v flock > /dev/null 2>&1; then | |
flock -nx "$LOCK" || exit | |
else | |
trap 'rm -f "$LOCK"; exit' INT QUIT TERM | |
shlock -f "$LOCK" -p $$ || exit | |
trap 'rm -f "$LOCK"; exit' EXIT | |
fi |
This file contains hidden or 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
# Prefer the timeout program from GNU coreutils. | |
if command -v timeout > /dev/null 2>&1; then | |
: | |
elif command -v gtimeout > /dev/null 2>&1; then | |
timeout () { | |
gtimeout $@ | |
} | |
else | |
# From "Beginning Portable Shell Scripting", 2008. | |
timeout () { |
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use XML::LibXML; | |
my $user = shift || die "No user specified\n"; | |
my $feed_url = ( | |
"http://gdata.youtube.com/feeds/api/users/$user/uploads?" . | |
'max-results=50' |
This file contains hidden or 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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Benchmark qw(cmpthese); | |
use GTop; | |
use Proc::ProcessTable; | |
my $gtop = GTop->new; | |
my $ptable = Proc::ProcessTable->new(cache_ttys => 1); |
This file contains hidden or 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
# Clear the cable modem logfile from memory to prevent slowdowns. | |
14 */2 * * * curl -sS -u admin:cableroot --basic -d SnmpClearEventLog=2 http://192.168.100.1/goform/CmEventLog |
This file contains hidden or 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
# Switch Tor circuits (generate new identity). | |
printf "AUTHENTICATE %s\nSIGNAL NEWNYM\nQUIT\n" \ | |
$(xxd -c32 -ps ~/.tor/control_auth_cookie) | nc localhost 9051 |
This file contains hidden or 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
#!/usr/bin/env perl | |
use 5.010; | |
use strict; | |
use warnings; | |
use Carp::Always; | |
use List::Util qw(any none); | |
use URI; | |
use URI::QueryParam; | |
use Web::Scraper::LibXML; |
This file contains hidden or 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
#!/usr/bin/env perl | |
use 5.012; | |
use warnings; | |
use CPAN::DistnameInfo; | |
use CPAN::Mini::Visit; | |
use File::Find::Rule; | |
use File::pushd; | |
CPAN::Mini::Visit->new( |
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use AnyEvent::HTTP; | |
use AnyEvent::HTTP::Socks; | |
use AnyEvent::HTTPD; | |
use URI; | |
# Default is 4 connections per host. | |
$AnyEvent::HTTP::MAX_PER_HOST = 8; |
This file contains hidden or 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
// ==UserScript== | |
// @name Autocomplete On | |
// @namespace http://gist.github.com/gray | |
// @description Undo the disabling of autocomplete on forms and inputs. | |
// @include * | |
// ==/UserScript== | |
// Note: other solutions on userscripts.org don't properly handle dynamically | |
// inserted widgets. This solution uses the new MutationObserver DOM API. |
OlderNewer