Skip to content

Instantly share code, notes, and snippets.

Andrew Fresh afresh1

Block or report user

Report or block afresh1

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@afresh1
afresh1 / keybase.md
Created Apr 8, 2014
Verify who I am on Keybase.
View keybase.md

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 Aug 29, 2015
A set of scripts to lock my screen and turn off the laptop screen
View lock_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 Nov 24, 2014
A script that checks for changed files and re-runs prove if they have changed.
View reprove.pl
#!/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 Jan 8, 2015
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.
View openbsd_knf.perltidyrc
--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 Feb 11, 2015
An ICB bot that watches for twitter URLs and fills out the text.
View icb_twitter_bot.pl
#!/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 Jul 9, 2015
Start tmux on login. This would go in your kshrc or bashrc
View tmux.rc
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 Apr 26, 2012
A handy Twitter streaming API script to watch woot's deals (especially when there is a wootoff)
View watch_woot.pl
#!/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
OpenBSD CVS Port to openbsd-wip
View import-cvs-to-git
#!/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 Dec 14, 2012
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…
View tcpbench_client.pl
#!/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 Dec 16, 2012
Some utility methods for converting lat/long to google/bing maps coordinates. EPSG:4326 and EPSG:3856
View lat_lon_to_from_google.pl
# 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;
You can’t perform that action at this time.