Skip to content

Instantly share code, notes, and snippets.

💣
'); DROP TABLE statuses; --

Ian Littman iansltx

💣
'); DROP TABLE statuses; --
Block or report user

Report or block iansltx

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
View UuidModel.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Ramsey\Uuid\Uuid;
// Abstract class using inheritance rather than composition to avoid trait override errors
abstract class UuidModel extends Model
{
View ModifyExistingEnum.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ModifyExistingEnum extends Migration
{
public function up()
{
View More optimized load test result
/\ |‾‾| /‾‾/ /‾/
/\ / \ | |_/ / / /
/ \/ \ | | / ‾‾\
/ \ | |‾\ \ | (_) |
/ __________ \ |__| \__\ \___/ .io
execution: local
output: influxdb=http://influxdb:8086/k6 (http://influxdb:8086)
script: /scripts/base.js
View getLines.php
<?php // works on single-file non-ZIp64 zip files compressed with deflate (AKA a common case), licensed MIT
function getLinesFromZippedCSVfromURL(string $url) : \Generator
{
$stream = fopen($url, 'rb');
fread($stream, 4 + 2 + 2 + 2 + 2 + 2 + 4); // skip up to compressed size
// bindec() was doing weird things, hence converting through hex first
// sttrev() to match endian-ness to expectations; zip file values are little-endian
@iansltx
iansltx / talks.php
Created Apr 30, 2019
List of everyone who has submitted Joind.in talk comments for a given event
View talks.php
<?php
$eventId = 7021;
#$eventId = 7045; #Yorkshire, for testing
$comments = json_decode(file_get_contents('https://api.joind.in/v2.1/events/'.$eventId.'/talk_comments?resultsperpage=9999'), true)['comments'];
$users = [];
foreach ($comments as $comment) {
@iansltx
iansltx / With.php
Created Feb 27, 2019
Simulating Python's With keyword with foreach and a trait in PHP
View With.php
<?php // Pretty sure this doesn't clean up on exceptions, so keep that in mind
trait With
{
abstract protected function enter(...$args);
protected function exit($built, ...$initArgs)
{
// override this if needed
}
@iansltx
iansltx / distributions.js
Created Jul 28, 2018
AndreasMadsen/distributions browserified
View distributions.js
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.distributions = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
exports.Normal = require('./distributions/normal.js');
exports.Studentt = require('./distributions/studentt.js');
exports.Uniform = require('./distribut
@iansltx
iansltx / downloader.php
Created Apr 1, 2018
Quick S3 bulk downloader
View downloader.php
<?php // requires aws/aws-php-dsk
// reads s3://bucket/key.ext lines from STDIN, saves them to ../files
require __DIR__ . '/vendor/autoload.php';
ini_set("memory_limit", "2G"); // impacted by concurrency + file sizes, since we aren't streaming
$s3 = new Aws\S3\S3Client(['credentials' => [
'key' => 'KEY_HERE', 'secret' => 'SECRET_HERE'
@iansltx
iansltx / jtt.php
Last active May 16, 2018
Quick CLI for adding work log times in JIRA
View jtt.php
#!/usr/bin/env php
<?php
if ($argc < 3) {
die("Usage: ./jtt.php ISSUE-1 30m optional comment here\n");
}
$username = 'EMAIL_GOES_HERE';
$token = 'API_KEY_HERE'; // see https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-basic-authentication/
$team = 'TEAM_NAME_HERE';
View keybase.md

Keybase proof

I hereby claim:

  • I am iansltx on github.
  • I am iansltx (https://keybase.io/iansltx) on keybase.
  • I have a public key whose fingerprint is E573 8C97 94FB 9EB7 5BBB D66B A837 4166 D3C2 1523

To claim this, I am signing this object:

You can’t perform that action at this time.