Skip to content

Instantly share code, notes, and snippets.

Avatar
💣
'); DROP TABLE statuses; --

Ian Littman iansltx

💣
'); DROP TABLE statuses; --
View GitHub Profile
@iansltx
iansltx / _safari-iframe-cookie-workaround.md
Last active Sep 10, 2021
Safari iframe cookie workaround
View _safari-iframe-cookie-workaround.md
@iansltx
iansltx / MultiPartFromStrings.php
Created May 2, 2015
Multipart file uploads in PHP from strings
View MultiPartFromStrings.php
<?php
/**
* PHP's curl extension won't let you pass in strings as multipart file upload bodies; you
* have to direct it at an existing file (either with deprecated @ syntax or the CURLFile
* type). You can use php://temp to get around this for one file, but if you want to upload
* multiple files then you've got a bit more work.
*
* This function manually constructs the multipart request body from strings and injects it
* into the supplied curl handle, with no need to touch the file system.
View chromium-os-docker.md

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 / jtt.php
Last active Apr 29, 2021
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';
@iansltx
iansltx / property-bench.php
Created Apr 10, 2020
Microbenchmark for typed property vs. setter
View property-bench.php
<?php
// Compares the performance of a trivial typehinted setter with a public typed property
define('ITERATIONS', 1_000_000);
ini_set('memory_limit', '384M');
$arrays = [];
echo "Building data...";
@iansltx
iansltx / 2020-08-23 17:44.txt
Created Aug 23, 2020
Nighthawk M1 Austin AT&T Field Test
View 2020-08-23 17:44.txt
ian@fiora:~/Desktop/platform-tools$ telnet 192.168.1.1 5510
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
AT!GSTATUS?
AT!GSTATUS?
!GSTATUS:
Current Time: 1035 Mode: ONLINE
System mode: LTE PS state: Attached
EMM state: Registered Normal Service
@iansltx
iansltx / Container.php
Last active Sep 12, 2019
Dependency Injection Sample Code - 2019
View Container.php
<?php
class Container implements Psr\Container\ContainerInterface {
protected $s = [];
function __set($k, $c) { $this->s[$k]=$c; }
function __get($k) { return $this->s[$k]($this); }
function get($k) { return $this->s[$k]($this); }
function has($k) { return isset($s[$k]); }
}
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