Skip to content

Instantly share code, notes, and snippets.

View tvlooy's full-sized avatar
🐧
<(o)

Tom Van Looy tvlooy

🐧
<(o)
View GitHub Profile
@tvlooy
tvlooy / validator.php
Created July 28, 2015 10:26
Symfony validator without entities or objects
<?php
// See http://symfony.com/doc/current/book/validation.html#validating-values-and-arrays
$email = $app['request']->get('email');
$emailConstraint = new \Symfony\Component\Validator\Constraints\Email();
$emailConstraint->message = 'Invalid email address';
$errorList = $val->validate(
$email,
$emailConstraint
);
var_dump($errorList);
@tvlooy
tvlooy / ipv6_telenet.txt
Last active August 29, 2015 14:27
IPv6 bij telenet
Abbo: basic internet
Modem: modem-only DOCSIS 3.0
Router: Soekris / OpenBSD 5.7
-----
Test via autoconfiguration:
(inet6 autoconfig in /etc/hostname.vr0)
Tcpdump:
@tvlooy
tvlooy / 01.php
Created June 23, 2011 19:22 — forked from smasty/01.php
10 PHP One Liners to Impress Your Friends
<?
foreach(range(1, 10) as $i) echo $i * 2 . " ";
@tvlooy
tvlooy / image_gallery.html
Created November 24, 2011 10:28
simple jQuery image gallery
[tvl@novo /var/www/html/leeshoek.home.ctors.net/Symfony]
$ app/console behat -e=test
Functionaliteit: Gebruiker moet gebruikers kunnen verwijderen
Om gebruikers te kunnen verwijderen
Met een beheerder
Moet ik een verwijder knop kunnen gebruiken
Scenario: Roep knop op als leerkracht # src/Ctors/ReadingCornerBundle/Features/User/remove.feature:7
Gegeven ik ben ingelogd als "leerkracht" # Ctors\ReadingCornerBundle\Features\Context\ReadingCornerContext::ikBenIngelogdAls()
Als ik naar "/user/1/remove" ga # Ctors\ReadingCornerBundle\Features\Context\ReadingCornerContext::visit()
@tvlooy
tvlooy / BabeRotate.php
Created December 16, 2011 19:48
The babe rotator - V2
<?php
function jpg ($file) { return substr($file, -4) == '.jpg'; }
$imgs = array_filter(scandir('.'), 'jpg');
$max = count($imgs);
shuffle($imgs);
?>
<html>
<body>
<img src="<?php echo $imgs[0]; ?>" id="cur_img" onclick="next();" height="100%" />
<img src="<?php echo $imgs[1]; ?>" id="nxt_img" onclick="next();" style="display: none;" />
@tvlooy
tvlooy / facebook-blocker.sh
Created May 7, 2012 21:54
How to block facebook in a very funny way
#!/bin/bash
while [ TRUE ]; do
detect=$(netstat -an | grep `dig +short www.facebook.com` | grep ESTA | wc -l)
if [ $detect -ne 0 ]; then
osascript -e "set Volume 7"
say -v Zarvox "computer says no, `whoami`"
killall Safari
sleep 10
fi
@tvlooy
tvlooy / rentplus_poc.php
Created May 31, 2012 18:11
Rentplus SOAP proof of concept
<?php
class XmlSerializer {
private static $xmlns = 'www.rentplus.be/webservices/';
public static function toXml($obj) {
$class = get_class($obj);
$xml = '<?xml version="1.0" standalone="yes"?>' .
'<ds' . $class . ' xmlns="' . self::$xmlns . $class . '.xsd">' .
self::serialize($obj) .
@tvlooy
tvlooy / gist:3795348
Created September 27, 2012 17:42
SensioLabsDesktop segfault
[tvl@orion ~]
$ uname -a
Linux orion 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[tvl@orion ~]
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
@tvlooy
tvlooy / etc_vim_vimrc.local
Last active December 8, 2015 22:40
My vimrc file
syntax on
colors elflord
set tabstop=4
"set softtabstop=4
set expandtab
set number
"set showcmd
set cursorline
"set wildmenu
"set lazyredraw