Skip to content

Instantly share code, notes, and snippets.

View lorin's full-sized avatar
🤷‍♂️
Nominal

Lorin Hochstein lorin

🤷‍♂️
Nominal
View GitHub Profile
@lorin
lorin / icanhazip
Created June 9, 2014 13:54
Ansible module for icanhazip
#!/bin/sh
IP=`curl --silent icanhazip.com`
echo "changed=false ip=$IP"
@lorin
lorin / keybase.md
Created October 31, 2019 06:07
keybase.md

Keybase proof

I hereby claim:

  • I am lorin on github.
  • I am lorin (https://keybase.io/lorin) on keybase.
  • I have a public key ASBR2Fv6tYAWlp-BmSRLhBNCWqAE5ZE3dj25dwiEJFv_6go

To claim this, I am signing this object:

@lorin
lorin / png.js
Last active April 3, 2018 21:03
Convert svg to png with styling using phantomjs
#!/usr/bin/env phantomjs
/*
* Convert svg to png using PhantomJS
*
* Usage: png.js filename.svg filename.png
*
* Asses width and height attributes are present on the svg node
*
*/
var system = require('system');
@lorin
lorin / blog.json
Created July 30, 2012 14:28
Example Mezzanine blog fixtures
[
{
"pk": 1,
"model": "blog.blogpost",
"fields": {
"status": 2,
"expiry_date": null,
"allow_comments": true,
"description": "This is an example of a blog post.",
"title": "example blog post",
@lorin
lorin / increment.tla
Last active October 3, 2017 06:19
Simple increment race condition
EXTENDS Naturals
CONSTANT N
(*
--algorithm Increment
variable count=0;
process Proc \in 1..N
@lorin
lorin / Simple.tla
Last active September 8, 2017 05:44
Simple PlusCal model and TLAPS proof of simple program from Lamport's "Teaching Concurrency"
------------------------------- MODULE Simple -------------------------------
\* From "Teaching Concurrency" by Leslie Lamport
\* https://www.microsoft.com/en-us/research/publication/teaching-concurrency/
\* See also: https://stackoverflow.com/a/46108331/742
EXTENDS Naturals, TLAPS
CONSTANTS N
@lorin
lorin / sockpath.c
Last active July 7, 2016 01:27
Output maximum path length of unix domain socket
#include <sys/un.h>
#include <stdio.h>
int main()
{
struct sockaddr_un s;
printf("%lu\n", sizeof(s.sun_path));
return 0;
}
@lorin
lorin / gist:4478637
Created January 7, 2013 21:31
Annotate a request object with session. Useful for requests that are generated by the RequestFactory for testing
from django.contrib.sessions.middleware import SessionMiddleware
def add_session_to_request(request):
"""Annotate a request object with a session"""
middleware = SessionMiddleware()
middleware.process_request(request)
request.session.save()
<a id="logABugLink" href="">Log a bug</a>
<script language="JavaScript">
var bugTitle = "4.1. Simplicity in Cloud Files™ Introduction - API v1";
var buildTime = "Built 20130918T23 04 24Z05 00"
var docUrl = "at url " + window.location.pathname;
var gitSha = "git SHA a997cbc1" ;
var gitRepo = "git Repo git@github.rackspace.com:IX/cloud-files.git ";
var lineFeed = "%0A";
var fieldComment = encodeURI(buildTime) + lineFeed + encodeURI(gitSha) + lineFeed + encodeURI(docUrl) + lineFeed + encodeURI(gitRepo);
@lorin
lorin / prepare-commit-msg
Created August 29, 2013 03:08
A git hook for annotating a git commit message with info about an associated Trello card.
#!/usr/bin/python
"""
This is a prepare-commit-msg hook for use with git-flow and Trello
Copy this file to $GITREPOSITORY/.git/hooks/prepare-commit-msg
It will prepend [<card id>] to your commit message, and append a
link to the Trello card at the end of the commit message
Assumes you name your feature branches card-id/name.