Skip to content

Instantly share code, notes, and snippets.

View grantm's full-sized avatar

Grant McLean grantm

View GitHub Profile
@grantm
grantm / no-more-f-s-git-log.txt
Last active April 1, 2022 19:57
git log for the repo with no more f***s to give
$ git clone https://github.com/grantm/no-more-f-s-repo.git
Cloning into 'no-more-f-s-repo'...
remote: Enumerating objects: 279, done.
remote: Counting objects: 100% (279/279), done.
remote: Compressing objects: 100% (97/97), done.
remote: Total 279 (delta 87), reused 279 (delta 87), pack-reused 0
Receiving objects: 100% (279/279), 22.66 KiB | 2.83 MiB/s, done.
Resolving deltas: 100% (87/87), done.
$ cd no-more-f-s-repo/
$ git --no-pager log
$the_cow = <<EOC;
$thoughts
$thoughts __
/ \\
| |
@ @
|| ||
|| ||
|\\_/|
\\___/
@grantm
grantm / start-es.sh
Created August 1, 2012 21:31
Launch ES with ulimit raise for more filehandles
#!/bin/bash
ES_BINARY=/home/grant/elasticsearch-0.18.7/bin/elasticsearch
if [ -z "$1" ]
then
sudo $0 as-root $USER
stty sane
elif [ "$1" = "as-root" ]
then
### Keybase proof
I hereby claim:
* I am grantm on github.
* I am grantmnz (https://keybase.io/grantmnz) on keybase.
* I have a public key ASCDS3p9-PMlPFwXwLZqwrGgF5c2zAE8XKb0aEODSMQNBQo
To claim this, I am signing this object:
@grantm
grantm / metacpan-v1-fields.md
Created November 13, 2016 20:43
Metacpan API /v1 fields
@grantm
grantm / console.log
Created December 22, 2015 06:03
DNS queries against Slingshot nameservers
~$ host www.lighthousepetone.co.nz 202.180.64.10
Using domain server:
Name: 202.180.64.10
Address: 202.180.64.10#53
Aliases:
Host www.lighthousepetone.co.nz not found: 2(SERVFAIL)
~$ host www.lighthousepetone.co.nz 202.180.64.11
Using domain server:
Name: 202.180.64.11
@grantm
grantm / gist:5242453
Created March 26, 2013 01:47
cpan-api test failures
$ prove -l -v
t/fakecpan.t ..
ok 1 - got ElasticSearch object
ok 2 - Connected to the ElasticSearch test instance on 127.0.0.1:9900
ok 3 - put mapping
ok 4 - remove old fakepan
ok 5 - make fake cpan
ok 6 - index fakecpan
ok 7 - latest
ok 8 - index authors
@grantm
grantm / gist:4773217
Last active December 12, 2015 12:39
Syntactic sugar for DBIx::Class stuff in Dancer
# In my Dancer app I load a 'user' record like this:
my $user = User->find( param('id') ); # usually wrapped in a check that the record was found
# There are a number of 'moving parts' to allow this to work.
# Near the top of my Dancer code I have this:
@grantm
grantm / gist:4367372
Last active December 10, 2015 02:28
Ever forgotten the ':' after the hostname of an scp command?
# a useful addition to anyone's .bashrc
#
# Note, you don't want this function in effect on the remote host side of the scp transfer,
# so make sure to only define it for interactive shells, e.g.: wrap with: if [ ! -z "$PS1" ]
function scp() {
if echo "$@" | grep -q ':'
then
/usr/bin/scp "$@"
else
@grantm
grantm / diff-encoding.patch
Created September 27, 2012 02:33
Best efforts decoding of output from diff command
diff --git a/lib/MetaCPAN/Server/Diff.pm b/lib/MetaCPAN/Server/Diff.pm
index 2f90e6e..98c6306 100644
--- a/lib/MetaCPAN/Server/Diff.pm
+++ b/lib/MetaCPAN/Server/Diff.pm
@@ -2,6 +2,7 @@ package MetaCPAN::Server::Diff;
use Moose;
use IPC::Run3;
+use Encoding::FixLatin qw(fix_latin);