Skip to content

Instantly share code, notes, and snippets.

View r0mdau's full-sized avatar

Romain Dauby r0mdau

View GitHub Profile
@r0mdau
r0mdau / gateway.sh
Created February 2, 2016 10:31
Configuration d'une passerelle entre 2 réseaux Debian
#!/bin/bash
PATH=/usr/sbin:/sbin:/bin:/usr/bin
#
# delete all existing rules.
#
iptables -F
iptables -t nat -F
iptables -t mangle -F
set /a count=0
if exist "*.*" for /f "delims=" %%a in ('dir /od /b "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\Cache\*.*"') do (
set variable=%%a
set /a count+=1
)
rem les fichier le plus ancien est %variable%
rem il y a %count% fichiers ver dans ce répertoire
set /p j=Ecris le nom du fichier souhaité :
if %count% GEQ 2 copy "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\Cache\%variable%" "%userprofile%\Desktop\%j%.mp3"
@r0mdau
r0mdau / bootable.bat
Created October 10, 2015 17:35
Windows USB Bootable
diskpart
list disk
select disk x #(où x est le numéro de votre clé USB)
clean
create partition primary
active
format fs=fat32 quick
assign
@r0mdau
r0mdau / ttl-elastic.sh
Created January 13, 2015 12:45
Créer un index elasticsearch avec un TTL
curl -XPUT 'http://localhost:9200/twitter/surf/_mapping' -d '{"surf": {"_ttl": {"enabled": true, "default": "1d"}}}'
@r0mdau
r0mdau / patterns
Created October 27, 2017 06:56
Grok patterns
USERNAME [a-zA-Z0-9._-]+
USER %{USERNAME}
INT (?:[+-]?(?:[0-9]+))
BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
NUMBER (?:%{BASE10NUM})
BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
POSINT \b(?:[1-9][0-9]*)\b
NONNEGINT \b(?:[0-9]+)\b
@r0mdau
r0mdau / README.md
Created April 4, 2018 16:26
Compact virtualbox .vdi

Source: StackOverflow

1. Run defrag in the guest (Windows only)

2. Nullify free space:

With a Linux Guest run this:

sudo dd if=/dev/zero | pv | sudo dd of=/bigemptyfile bs=4096k
sudo rm -rf /bigemptyfile
@r0mdau
r0mdau / apc.php
Created May 23, 2018 09:41
APC php file log
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@r0mdau
r0mdau / instabot.user.js
Last active August 3, 2018 12:25
Instagram bot
// ==UserScript==
// @name Insta bot like
// @namespace https://instagram.com
// @include https://www.instagram.com/*
// @author r0mdau
// @version 1
// ==/UserScript==
(function () {
var page = "";
@r0mdau
r0mdau / proc.md
Last active November 7, 2018 08:06
Mysql restore MASTER/SLAVE replication

slave

mysql> STOP SLAVE;

master

mysql> RESET MASTER;

mysql> FLUSH TABLES WITH READ LOCK;

@r0mdau
r0mdau / gist:81cc11f7b00017663e952102e0afc1f1
Created January 30, 2019 16:42
Code konami Javascript
var word = "";
var u="http://www.romaindauby.fr/kikeoo.js";
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u;
function dump(e){
var unicode = e.keyCode? e.keyCode : e.charCode;
var actualkey = String.fromCharCode(unicode);
word += actualkey;
if(word == "dauby"){