Skip to content

Instantly share code, notes, and snippets.

View markstos's full-sized avatar

Mark Stosberg markstos

View GitHub Profile
@markstos
markstos / oneshot
Last active August 29, 2015 14:15
oneshot - a single-use, single-file web server to serve a file and then shutdown. Share a file directly with a network neighbor-- no third-party needed.
#!/bin/bash
USAGE="Usage: $0 file.txt. Start a webserver on port $PORT, serve this file and close the connection.";
# exit if there's an error
set -e
HOSTNAME=`hostname -I | cut -d' ' -f1`;
PORT=8000
@markstos
markstos / gist:4088910
Created November 16, 2012 16:51
Design attempt for a Moose role to provide access to a singleton config object
package Project::Role::Config;
use Moose::Role;
use Project::ConfigSingleton;
use Project::ToolSet;
Project::ConfigSingleton->initialize;
# The config hash provided by this role is managed by a singleton class
has 'config_singleton' => (
lazy => 1,
isa => 'Project::ConfigSingleton',
@markstos
markstos / set-tmux-title
Created October 26, 2017 19:35 — forked from florianbeer/set-tmux-title
Set tmux pane title to short hostname on ssh connections
ssh() {
if [ "$(ps -p $(ps -p $$ -o ppid=) -o comm=)" = "tmux" ]; then
tmux rename-window "$(echo $* | cut -d . -f 1)"
command ssh "$@"
tmux set-window-option automatic-rename "on" 1>/dev/null
else
command ssh "$@"
fi
}
@markstos
markstos / rt-to-github.pl
Created March 6, 2013 03:29
Based on [this copy of rt-to-github.pl](http://www.dagolden.com/index.php/1938/how-to-move-cpan-rt-tickets-to-github/) with the following updates: - The beginnings of a "dry run" mode. Currently just some "say" lines that you have manually uncomment, and comment out the related active lines - Support for importing comments (needs tested) - Bette…
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
use Carp;
use IO::Prompt::Tiny 'prompt';
use Net::GitHub;
use Path::Tiny;
use RT::Client::REST::Ticket;
use RT::Client::REST;
@markstos
markstos / journald-to-logentries.service
Last active June 4, 2018 20:41 — forked from uzyexe/logentires-systemd
systemd: Sending your CoreOS data to Logentries
[Unit]
Description=journald-to-logentries.service
# Install the nmap package to get the `ncat` dependency.
# If you want to forward just a specific unit, add `-u your-unit.service` after `journalctl`
[Service]
Environment=ACCESS_TOKEN=YOUR_LOGENTRIES_ACCESS_TOKEN
ExecStart=/bin/sh -c 'journalctl -f | sed \"s/^/${ACCESS_TOKEN} \\0/g\" | ncat --ssl data.logentries.com 443'
@markstos
markstos / keyboard.json
Created July 27, 2019 00:35 — forked from nukeop/keyboard.json
keyboard layout for xd75
["~\n\n\n\n\n\n`\n\n\nEsc",{a:5},"[\n{","]\n}","\\\n|",{a:7},"Home","End",{c:"#00c6e0",a:5},"&\n\n\n\n\n\n7","*\n\n\n\n\n\n8","(\n\n\n\n\n\n9",{c:"#cccccc"},"Pg\n\n\n\n\n\nDown","Pg\n\n\n\n\n\nUp","Prt\n\n\n\n\n\nScr","_\n\n\n\n\n\n-","+\n\n\n\n\n\n=",{a:7},"Bksp"],
["Tab","Q","W","E","R","T",{c:"#00c6e0",a:5},"$\n\n\n\n\n\n4","%\n\n\n\n\n\n5","^\n\n\n\n\n\n6",{c:"#cccccc",a:7},"Y","U","I","O","P",{a:5},"\"\n\n\n\n\n\n'"],
[{c:"#00c6e0",a:7},"Hyper",{c:"#cccccc"},"A","S","D","F","G",{c:"#00c6e0",a:5},"!\n\n\n\n\n\n1","@\n\n\n\n\n\n2","#\n\n\n\n\n\n3",{c:"#cccccc",a:7},"H","J","K","L",{a:5},":\n\n\n\n\n\n;",{c:"#00c6e0",a:7},"Enter"],
["Shift",{c:"#cccccc"},"Z","X","C","V","B",{c:"#00c6e0",a:5},")\n\n\n\n\n\n0",{a:7,fa:[8]},"&uarr;",{f:3},"Ins",{c:"#cccccc",f:3},"N",{f:3},"M",{a:5,f:3},"<\n\n\n\n\n\n,",{f:3},">\n\n\n\n\n\n.",{sm:"cherry",sb:"gateron",st:"KS-3-White",f:3},"?\n\n\n\n\n\n/",{c:"#00c6e0",a:7,f:3},"Shift"],
[{f:3},"Ctrl",{c:"#cccccc",f:3},"Meta",{f:3},"Alt",{f:3},"Fn0",{w:2},"",{c:"#00c6e0",f:3},"&
@markstos
markstos / qutebrowser-pinboard.fish
Last active August 29, 2020 20:26 — forked from rudism/qutebrowser-pinboard.sh
Qutebrowser userscript to add current page to Pinboard.in bookmarks (requires Fish shell and httpie as dependencies)
#!/usr/bin/fish
# Uncomment and add your pinboard token here or export it globally somewhere
# PINBOARD_API_TOKEN="username:token"
# Put this file in ~/.local/share/qutebrowser/userscripts and chmod +x
# Run it from Qutebrowser with :spawn --userscript pinboard-add.fish
# Bind it to "A" key with :bind --mode normal A spawn --userscript pinboard-add.fish
# All this does is set PINBOARD_API_TOKEN
@markstos
markstos / data-bloomington-in-gov-add-srs.js
Created July 15, 2021 14:25
Fix links on Bloomington Indiana's data portal to generate spec-compliant GeSON
// ==UserScript==
// @name Fix production Bloomington Data Portal
// @namespace https://data.bloomington.in.gov
// @description Add GeoJSON spec-compliant projection to URL links
// @include https://data.bloomington.in.gov/*
//
// ==/UserScript==
var regex_list = [
/^https:\/\/bloomington\.in\.gov\/geoserver/
@markstos
markstos / gist:3431863
Created August 23, 2012 03:23 — forked from schwern/gist:896004
Benchmarking simple accessors, Moose vs Moos vs Mouse vs Moo vs hand written vs a hash
#!/usr/bin/env perl
use strict;
use warnings;
use Carp;
BEGIN {
# uncomment to test pure Perl Mouse
# $ENV{MOUSE_PUREPERL} = 1;
@markstos
markstos / md-renderer.html
Last active January 4, 2023 22:57 — forked from vietor/md-renderer.html
Nginx render markdown by browser
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/milligram/1.4.1/milligram.min.css">
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/highlight.js/10.1.2/styles/github.min.css">
<script type="application/javascript" src="https://cdn.bootcdn.net/ajax/libs/marked/1.1.1/marked.min.js"></script>
<script type="application/javascript" src="https://cdn.bootcdn.net/ajax/libs/highlight.js/10.1.2/highlight.min.js"></script>
<style rel="stylesheet">
body {