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 / 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 / ocp.php
Created April 9, 2013 09:30 — forked from ck-on/ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_, GK, stasilok
Version: 0.1.3
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.3 2013-03-30 show host and php version, can bookmark with hashtag ie. #statistics - needs new layout asap
0.1.2 2013-03-25 show optimization levels, number formatting, support for start_time in 7.0.2
module InventoryItems(Command(..), Event(..), handle) where
import Data.Maybe(isJust)
type Id = String
type Name = String
type Amount = Int
data Command = CreateInventoryItem Id
| RenameInventoryItem Id Name
@tvlooy
tvlooy / build_nginx.sh
Last active January 24, 2017 04:31 — forked from Belphemur/build_nginx.sh
Compiling Nginx with LibreSSL & HTTP/2 patch
#!/bin/bash
set -e
# Names of latest versions of each package
export NGINX_VERSION=1.9.4
export VERSION_PCRE=pcre-8.37
export VERSION_LIBRESSL=libressl-2.2.3
export VERSION_NGINX=nginx-$NGINX_VERSION
@tvlooy
tvlooy / tcpdump-es-capture
Created June 26, 2017 11:29 — forked from z0mbix/tcpdump-es-capture
Capture Elasticsearch Queries
# 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...^.@[email protected]#...}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 / ttfb.sh
Created September 27, 2017 13:14 — forked from sandeepraju/ttfb.sh
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
@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 / 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: