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 / ttfb.sh
Created March 7, 2018 09:42
curl ttfb
# 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 / feestdagen.php
Last active March 25, 2024 21:40
Feestdagen berekenen
<?php
// (c) Tom Van Looy <tom@ctors.net> https://ctors.net/isc_license.txt
// Alle feestdagen kunnen berekend worden, de berekende zijn allemaal
// afhankelijk van pasen. PHP heeft een functie easter_date().
// Makkie dus. Hoe easter_date() zelf werkt kan je hier raadplegen:
// https://github.com/php/php-src/blob/master/ext/calendar/easter.c
// Geen parameter? Doen we gewoon dit jaar toch.
@tvlooy
tvlooy / vmm_howto.md
Last active February 28, 2024 15:14
OpenBSD VMM howto

OpenBSD VMM howto

Setup

/etc/rc.conf.local

apmd_flags="-A"
dhcpd_flags=vether0
vmd_flags=
ntpd_flags="-s"
@tvlooy
tvlooy / unit.sh
Last active February 4, 2024 04:20
Bash test: get the directory of a script
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else
@tvlooy
tvlooy / rabbitmq.sh
Last active July 31, 2023 07:33
RabbitMQ add users configure queues
#!/bin/bash
VHOST=project
EXCHANGE=project-exchange
ADMIN_USER=admin
ADMIN_PASS=secret
MGMT_USER=mgmt
MGMT_PASS=secret
QUEUE1=queue1
QUEUE2=queue2
@tvlooy
tvlooy / device.xml
Created August 1, 2020 17:18
Samsung Galaxy S8 AVD Hardware Profile
<?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 April 15, 2023 15:37
ckermit ubuntu 20.04
@tvlooy
tvlooy / README.md
Created February 15, 2023 13:22 — forked from chrispage1/README.md
Restoring databases using Docker

Restoring databases using Docker

This guide requires you have the original database directories handy. You may also struggle restoring InnoDB instances because of the way they work, however a guide can be found at the bottom of this gist.

Move your backup database folders to an appropriate location, a temporary folder is preferable as MariaDB will put its own data within this directory.

Within the directory, run the following docker command:

@tvlooy
tvlooy / dealing_with_email_testing.md
Last active October 13, 2022 15:47
Dealing with email on a testing server

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.

@tvlooy
tvlooy / example.vhost
Created November 23, 2016 07:12
PHP 7 FPM on Apache 2.2 with PHP 5 mod_php running
<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 />