Skip to content

Instantly share code, notes, and snippets.

View iansltx's full-sized avatar
💣
'); DROP TABLE statuses; --

Ian Littman iansltx

💣
'); DROP TABLE statuses; --
View GitHub Profile
@iansltx
iansltx / local-branch-high-level.md
Last active August 29, 2015 14:21
Local branch sharing

mDNS shows local machines

There are two network-related components of this utility: announce and pull. When you want to share a repo or branch with another user, you'll send an announcement to their host. That announcement will contain enough information to fetch the branch/repo from your system. When the targeted user receives the announcement, they can either ignore it or accept it. In the latter case, they may fetch the repo into its own new repo/branch or merge it with an existing local repo/branch via a temporary remote that lasts until they've finished pulling. If they want to share changes back with you, they announce the availability of a branch with the specified changes and you can accept/pull from them. Pushing from point to point (not counting the announcement) is not supported.

To allow for finer-grained ACLs, the announced remote is exposed via HTTP on a >1024 port with a set of credentials specific to a given announcement (which can contain exactly one repo or branch). The web server at this

@iansltx
iansltx / README.md
Last active August 29, 2015 14:23
Messenger Mini Bookmarklet

To install this, create a bookmark and copy and paste the above verbatim into there. To use it, first go to the conversation you want to single out in messenger.com, then navigate to the bookmarklet you created. The lefthand conversation list pane will vanish, and you'll be left with the IMs for your conversation in a window that has no minimum width (normally the conversation pane has a minimum width).

As fair warning, if Facebook updates the Messenger app then this hack may (probably will) stop working. This code is provided as-is and with no warranty whatsoever.

@iansltx
iansltx / Dockerfile
Created March 1, 2016 03:04
runit + php7 dev server + better ctrl-c response Docker
FROM alpine:3.3
# install packages
RUN echo "@testing http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk add --update php7-common@testing php7-pdo_mysql@testing \
php7-pcntl@testing php7-json@testing php7-opcache@testing \
php7-mbstring@testing php7-fpm@testing php7@testing nginx runit@testing
# set up app
RUN mkdir /var/app
<?php
if ($argc < 3) {
error_log("Usage: php gitlab_archive.php <private_token> <namespaced path> <optional-branch-or-commit-sha> > archive.tar.gz"); die();
}
$token = $argv[1];
$path = $argv[2];
$ref = isset($argv[3]) ? $argv[3] : null;
@iansltx
iansltx / gen.php
Last active July 14, 2016 22:49
Generator Scratchpad
<?php
function gen($arg1) {
var_dump($b = yield $arg1 + 1);
var_dump($d = yield $b + 2);
$ret = $d + 2;
var_dump($ret);
return $ret;
}

Chromium OS ft. Docker

Chromium OS is cool. Chromium OS with crouton is cooler. Chromium OS with Docker is even cooler. This is specifically a guide for the HP Chromebook 13 G1 (aka HP Spyder Chromebook), but I can't think of any reason it wouldn't work with other devices. The Chromebook Pixel 2 (2015), for example...as you'll notice, the guide this was forked from assumed that machine.

  1. Create a build environment
  2. Customize the kernel
  3. Build Chromium OS
  4. Flash Chromium OS to USB
  5. Install Chromium OS
@iansltx
iansltx / ting.php
Last active September 23, 2016 03:33
Ting CSV parser
<?php
if ($argc < 4) {
die("Usage: php ting.php minutesXXX.csv messagesXXX.csv megabytesXXX.csv\n");
}
$people = [];
$voice = fopen($argv[1], 'r');
$sms = fopen($argv[2], 'r');
If each state got one electoral college vote per 50B in GDP, rounded to the nearest 50B
CA - 48
TX - 33
NY - 29
FL - 18
IL - 15
PA - 14
OH - 12
NJ - 12
@iansltx
iansltx / asns201704152300.json
Last active April 16, 2017 04:30
Mastodon Instance ASN Lookup
{
"mastodon.social": {
"asn": "12876",
"desc": "AS12876, FR"
},
"mastodon.xyz": {
"asn": "16276",
"desc": "OVH, FR"
},
"awoo.space": {
@iansltx
iansltx / README.md
Last active September 7, 2017 16:39
Build a Bot - PNWPHP 2017