Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Van Looy tvlooy

View GitHub Profile
@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';
@tvlooy
tvlooy / xdebug.ini
Created Nov 30, 2017
xdebug profiling tracing
View xdebug.ini
zend_extension=/usr/lib/php5/20100525/xdebug.so
;xdebug.remote_enable=1
;xdebug.remote_autostart=1
;xdebug.remote_host=192.168.33.1
;xdebug.max_nesting_level=256
;xdebug.profiler_enable=1
;xdebug.profiler_output_dir=/tmp/xdebug
@tvlooy
tvlooy / dealing_with_email_testing.md
Last active Jul 16, 2020
Dealing with email on a testing server
View dealing_with_email_testing.md

Dealing with email on a testing server

There are lots of setups with programs that can collect email in testing environments. Some of them require you to install perl, nodejs, ruby, ... or require you do do a sophisticated setup with your mailserver.

But there is a little program called mailhog that is just a standalone statically linked binary that has no dependencies.

That makes it very easy to use.

You can’t perform that action at this time.