Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
<(o)

Tom Van Looy tvlooy

💭
<(o)
View GitHub Profile
@tvlooy
tvlooy / sfmatrix.php
Created Oct 7, 2020
sfmatrix - simulates the display from "The Matrix"
View sfmatrix.php
#!/usr/bin/env php
<?php
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Console\Cursor;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;
use Symfony\Component\Console\Terminal;
@tvlooy
tvlooy / io.php
Created Oct 7, 2020
Intracto IO animation
View io.php
#!/usr/bin/env php
<?php
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Console\Cursor;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;
use Symfony\Component\Console\Terminal;
@tvlooy
tvlooy / device.xml
Created Aug 1, 2020 — forked from pg/device.xml
Samsung Galaxy S8 AVD Hardware Profile
View device.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<d:devices xmlns:d="http://schemas.android.com/sdk/devices/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<d:device>
<d:name>Samsung Galaxy S8</d:name>
<d:manufacturer>User</d:manufacturer>
<d:meta/>
<d:hardware>
<d:screen>
<d:screen-size>large</d:screen-size>
<d:diagonal-length>5.80</d:diagonal-length>
@tvlooy
tvlooy / ckermit.md
Last active Jul 28, 2020
ckermit ubuntu 20.04
View ckermit.md
View shell.php
<?php
if ($_SERVER['PHP_AUTH_USER'] !== 'tvlooy' ||
$_SERVER['PHP_AUTH_PW'] !== 'secret'
) {
header('WWW-Authenticate: Basic realm="Login required"');
header('HTTP/1.0 401 Unauthorized');
echo 'Access denied.';
exit;
}
@tvlooy
tvlooy / ffi_pledge.md
Last active Jan 21, 2019
PHP FFI obsoletes pecl/pledge
View ffi_pledge.md

PHP FFI obsoletes pecl/pledge

Example with pecl/pledge:

$ cat test_pecl.php
<?php

var_dump(count(scandir('/etc')));
unveil(__DIR__, 'r');
@tvlooy
tvlooy / install.sh
Last active Jun 3, 2019
Use OpenBSD's pledge and unveil syscalls in PHP
View install.sh
# Note that this is for people that want to build it from source, using pecl
# This code is in official OpenBSD ports now https://marc.info/?l=openbsd-ports-cvs&m=154270973708561
pkg_add php-7.2.10
ln -s /usr/local/bin/php-7.2 /usr/local/bin/php
ln -s /usr/local/bin/phpize-7.2 /usr/local/bin/phpize
ln -s /usr/local/bin/php-config-7.2 /usr/local/bin/php-config
pkg_add autoconf-2.69p2
export AUTOCONF_VERSION=2.69
View validate.sql
DELIMITER $$
DROP PROCEDURE IF EXISTS ANALYZE_INVALID_FOREIGN_KEYS$$
CREATE
PROCEDURE `ANALYZE_INVALID_FOREIGN_KEYS`(
checked_database_name VARCHAR(64),
checked_table_name VARCHAR(64),
temporary_result_table ENUM('Y', 'N'))
View ttfb.sh
# Connect: %{time_connect}
# TTFB: %{time_starttransfer}
# Total time: %{time_total}
while [ true ]; do curl -o /dev/null -s -w "%{time_starttransfer}\n" https://www......./; sleep 15; done
@tvlooy
tvlooy / Company.php
Last active Mar 9, 2020
A small PHP userland enum replacement for SplEnum (spl_types)
View Company.php
<?php
namespace SomeDomain;
use Ctors\Enum;
class Company extends Enum
{
public const GOOGLE = 'Google';
public const TWITTER = 'Twitter';
You can’t perform that action at this time.