Skip to content

Instantly share code, notes, and snippets.

View afresh1's full-sized avatar

Andrew Hewus Fresh afresh1

View GitHub Profile
@afresh1
afresh1 / keybase.md
Created April 8, 2014 15:01
Verify who I am on Keybase.

Keybase proof

I hereby claim:

  • I am afresh1 on github.
  • I am afresh1 (https://keybase.io/afresh1) on keybase.
  • I have a public key whose fingerprint is 5B9A 7176 B30A 8D42 37D6 B9B3 4811 F661 BF7B CEAD

To claim this, I am signing this object:

@afresh1
afresh1 / lock_screen
Last active August 29, 2015 14:07
A set of scripts to lock my screen and turn off the laptop screen
#!/bin/sh
if ! pgrep xlock >/dev/null 2>&1; then
xlock -lockdelay 0 -endCmd ssh-add &
sleep 1
fi
sudo -k
ssh-add -D
@afresh1
afresh1 / reprove.pl
Created November 24, 2014 23:30
A script that checks for changed files and re-runs prove if they have changed.
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
use File::Find;
my %options_that_take_arguments = map { $_ => 1 }
qw( I P M e exec harness formatter source a archive j jobs state rc );
@afresh1
afresh1 / openbsd_knf.perltidyrc
Created January 8, 2015 05:37
A perltidyrc that mostly seems to give me OpenBSD knf in my perl. While it isn't perfect it is certainly closer than what I normally use.
--indent-columns=8
--entab-leading-whitespace=8
--continuation-indentation=4
--cuddled-else
--opening-sub-brace-on-new-line
@afresh1
afresh1 / icb_twitter_bot.pl
Created February 11, 2015 02:26
An ICB bot that watches for twitter URLs and fills out the text.
#!/usr/bin/perl
use strict;
use warnings;
# On OpenBSD, I have a port for p5-Bot-ICB and p5-Net-ICB
# pkg_add p5-Bot-ICB p5-LWP-Protocol-https p5-HTML-Tree p5-Text-Unidecode
use Bot::ICB;
use LWP::Simple;
use HTML::Tree;
@afresh1
afresh1 / tmux.rc
Created July 9, 2015 16:13
Start tmux on login. This would go in your kshrc or bashrc
if [ ! "$TMUX" ]; then
echo "Starting tmux . . ."
sleep 3
[ "$TERM" = "xterm" ] && TERM=xterm-256color
tmux -2 attach || tmux -2
exit
fi
@afresh1
afresh1 / watch_woot.pl
Created April 26, 2012 04:29
A handy Twitter streaming API script to watch woot's deals (especially when there is a wootoff)
#!/usr/bin/perl
# Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@afresh1
afresh1 / import-cvs-to-git
Created May 9, 2012 02:35
OpenBSD CVS Port to openbsd-wip
#!/bin/sh
# https://gist.github.com/gists/2641363
# https://github.com/jasperla/openbsd-wip
# $ cd ~/openbsd-wip && CVSROOT=:local:/cvsroot import-cvs-to-git misc/anyport
#GITROOT=~/openbsd-wip
#GITROOT=/usr/ports/mystuff
GITROOT=`pwd`
CVSROOT=${CVSROOT:-/cvs}
# SUBDIR can be any valid dirname without trailing /
@afresh1
afresh1 / tcpbench_client.pl
Created December 14, 2012 04:23
This is a [Mojolicious](http://mojolicio.us) streaming http server that opens a [tcpbench](http://www.openbsd.org/cgi-bin/man.cgi?query=tcpbench) connection to back to you. For me this lets me put the page on my server on the net and connect back to my home system and see the results on anything with a web browser. Mostly based on the [EventSour…
#!/usr/bin/perl
# Start this on a server someplace with tcpbench
# Start tcpbench -s on a machine that is the remote IP you are connecting the the web from
# Browse to the page.
use Mojolicious::Lite;
use Mojo::IOLoop;
use Mojo::IOLoop::Stream;
# Template with browser-side code
get '/' => sub {
@afresh1
afresh1 / lat_lon_to_from_google.pl
Created December 16, 2012 18:04
Some utility methods for converting lat/long to google/bing maps coordinates. EPSG:4326 and EPSG:3856
# Converted from http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
# http://trac.osgeo.org/proj/wiki/man_cs2cs
# similar to
# cs2cs -f "%.10f" +init=epsg:3857 +to +init=epsg:4326
# and
# cs2cs -f ".10f" +init=epsg:4326 +to +init=epsg:3857
# http://trac.osgeo.org/proj/wiki/man_cs2cs
use Math::Trig;