Skip to content

Instantly share code, notes, and snippets.

View afresh1's full-sized avatar

Andrew Hewus Fresh afresh1

View GitHub Profile
@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 / unifi.sh
Last active January 11, 2018 18:52
Command-line interface for the OpenBSD Ubiquiti [unifi port](http://ports.su/net/unifi)
#!/bin/sh
basename $0 |&
IFS=- read -p name cmd
if [ -z "$cmd" -a $# -gt 0 ]; then
cmd=$1
shift
fi
cmd=${cmd%svc}
@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 / 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 / firefox
Last active May 12, 2016 18:40
~/bin/firefox for OpenBSD. Raises the ulimits needed to keep Firefox from crashing regularly. (~/bin is in my path before /usr/local/bin)
#!/bin/sh
ulimit -n $(ulimit -Hn)
ulimit -d $(ulimit -Hd)
exec /usr/local/bin/firefox "$@"
@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 / make_updated_ports.pl
Last active December 28, 2015 14:49
A script that will create updated "starter" Makefiles for OpenBSD perl ports available on the CPAN. Should only require things in the base system, but does like an up-to-date /usr/ports path.
#!/usr/bin/perl
use strict;
use warnings;
# Copyright (c) 2013 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.
#
@afresh1
afresh1 / find_networks.sh
Last active July 16, 2018 14:30
A script to find and connect to known wifi networks on OpenBSD. Works for me on my iwn card in my laptop
#!/bin/sh
# find_network.sh - An OpenBSD Wireless Network configurator
# Looks for available networks listed at the end of the script
# Use this by adding "!/path/to/find_network.sh \$if" to your wlan hostname.if
if=$1
if [ -z "$if" ]; then
echo "Usage: $0 interface" >&2
exit 2;
fi
@afresh1
afresh1 / BingQuadkeys.pm
Created October 3, 2013 04:25
Translation of Bing Quadkeys helper functions to perl. Original code at http://msdn.microsoft.com/en-us/library/bb259689.aspx
package BingQuadkeys;
use Exporter qw(import);
use strict;
use warnings;
our @EXPORT_OK = qw(
clip
map_size
ground_resolution
map_scale
@afresh1
afresh1 / calagatorEvents.js
Last active December 24, 2015 11:19
A Google Script to copy Calagator Events I'm interested in to my calendar so I can get alarms. http://calagator.org https://script.google.com https://developers.google.com/apps-script/reference/calendar/
function calagatorFactory() {
var calagator = CalendarApp.getCalendarsByName('calagator')[0];
var start = new Date();
var end = new Date( start.getTime() + 7 * 24 * 60 * 60 * 1000 );
var findCopiedEvent = function(cal, event) {
var copy;
var events = cal.getEventsForDay( event.getStartTime() );
for (i in events) {