Skip to content

Instantly share code, notes, and snippets.

Tom Van Looy tvlooy

Block or report user

Report or block tvlooy

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
@tvlooy
tvlooy / tcpdump-es-capture
Created Jun 26, 2017 — forked from z0mbix/tcpdump-es-capture
Capture Elasticsearch Queries
View tcpdump-es-capture
# tcpdump -A -nn -s 0 'tcp dst port 9200 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i lo
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
14:32:33.525122 IP 127.0.0.1.49777 > 127.0.0.1.9200: Flags [P.], seq 313752908:313753888, ack 2465010394, win 257, options [nop,nop,TS val 2684167067 ecr 2684167066], length 980
E...^.@.@............q#...}L...............
..#...#.GET /index/_search HTTP/1.1
Host: 127.0.0.1:9200
Accept: */*
Content-Length: 845
Content-Type: application/x-www-form-urlencoded
@tvlooy
tvlooy / pe.sh
Last active Feb 14, 2017
Select php engine
View pe.sh
#!/bin/bash
# set this is your .bashrc ". ~/Tools/pe.sh 7.0"
# set this in your .bash_aliases "alias pe='. ~/Tools/pe.sh'"
VERSIONS=($(find /usr/local/ -maxdepth 1 -name 'php-*' | sort | cut -c16-))
VERSION=""
if [ -n "$1" ]; then
VERSION=$1
@tvlooy
tvlooy / xmlToArray.php
Created Jan 5, 2017
SimpleXML to array
View xmlToArray.php
<?php
function xmlToArray(SimpleXMLElement $xmlObject) : array
{
$array = [];
foreach ((array) $xmlObject as $elementName => $value) {
if (is_object($value)) {
if (empty($value)) {
$array[$elementName] = '';
} else {
@tvlooy
tvlooy / install.sh
Created Dec 12, 2016
MariaDB on OpenBSD
View install.sh
pkg_add -i mariadb-server
mkdir /var/mysql
chown _mysql:_mysql /var/mysql
mysql_install_db
rcctl start mysqld
mysqladmin -u root password vagrant
mysql_secure_installation
@tvlooy
tvlooy / example.vhost
Created Nov 23, 2016
PHP 7 FPM on Apache 2.2 with PHP 5 mod_php running
View example.vhost
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} !www.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301]
DocumentRoot /var/www/example/current/web
<Directory />
@tvlooy
tvlooy / errordocs.patch
Last active Nov 30, 2018
OpenBSD httpd errordocs patch
View errordocs.patch
Index: httpd.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/httpd.conf.5,v
retrieving revision 1.76
diff -u -p -u -r1.76 httpd.conf.5
--- httpd.conf.5 14 Nov 2016 10:28:31 -0000 1.76
+++ httpd.conf.5 21 Nov 2016 19:12:34 -0000
@@ -128,6 +128,9 @@ If not specified, it defaults to
within the
.Xr chroot 2
@tvlooy
tvlooy / vmm_howto.md
Last active Jul 25, 2019
OpenBSD VMM howto
View vmm_howto.md

OpenBSD VMM howto

Setup

/etc/rc.conf.local

apmd_flags="-A"
dhcpd_flags=vether0
vmd_flags=
ntpd_flags="-s"
View get_dns_blacklists.sh
#!/bin/sh
# "include: /etc/unbound/ad-blacklist.conf" in /var/unbound/etc/unbound.conf
# run this script as a daily cron
#
# The list URLs were taken from the pi-hole project.
# More experimental lists are at https://github.com/pi-hole/pi-hole/blob/master/adlists.default
TMPFILE=$( mktemp get_dns_blacklists-XXXXXXXXX )
trap 'rm -f $TMPFILE; exit 1' EXIT KILL INT QUIT TERM
View Java EE is dead. Stop using it
Java EE is dead. Stop using it
There is a lot of chatter on the internet about Java EE being dead. As someone who spent a lot of time implementing some of the core specs like CDI and also helping customers adopt JavaEE I was interested in determining if this is true.
Unfortunately the anecdotal evidence all points to JavaEE going the way of the DODO slowly. I am here to ring the bell. Please write all your future apps with Spring, LightBend etc., or even no framework.
This is the evidence now points towards JavaEE being dead:
1. Most of the prominent Java EE evangelists - Folks who in some cases are friends and I admire deeply have left their respective Java EE shepherd companies. Reza Rahman from Oracle, Kenny Bastani from Oracle and Arun Gupta from Redhat to name just a few ...
2. Oracle, Redhat and IBM - the three most prominent supporters of JavaEE are now spending their money and developers innovating elsewhere. Oracle cloud,OpenShift and Bluemix respectively.
@tvlooy
tvlooy / analysis.txt
Last active Dec 17, 2015
find . -name "*.php" > phan.txt; ./vendor/bin/phan -f phan.txt | grep -v '^./vendor' | grep -v './tests' | grep -v '/Tests/' | grep -v 'simpletest' > analysis.txt
View analysis.txt
./core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php:306 ParamError required arg follows optional
./core/modules/block/src/Entity/Block.php:78 UndefError Can't access undeclared constant \Drupal\block\Entity\block::BLOCK_REGION_NONE
./core/modules/migrate/src/Plugin/migrate/destination/DestinationBase.php:42 UndefError Can't access constant ROLLBACK_DELETE from undeclared class MigrateIdMapInterface
./core/modules/migrate/src/MigrateMessage.php:23 UndefError Can't access constant INFO from undeclared class RfcLogLevel
./core/modules/migrate/src/MigrateMessage.php:24 UndefError Can't access constant ERROR from undeclared class RfcLogLevel
./core/modules/migrate/src/Entity/Migration.php:116 TypeError assigning array to property but \Drupal\migrate\Entity\migration::idmap is string
./core/modules/migrate/src/Entity/Migration.php:162 UndefError Can't access undeclared constant \Drupal\migrate\Entity\migration::SOURCE
./core/modules/search/src/SearchQuery.php:506 TypeError Default value for float $multi
You can’t perform that action at this time.