Skip to content

Instantly share code, notes, and snippets.

View r0mdau's full-sized avatar

Romain Dauby r0mdau

View GitHub Profile
@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"){
@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 / 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 / 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
ddrescue -n /dev/hda1 /mnt/fichier_copie.img mapfile
ddrescue -r3 -d /dev/hda1 /mnt/fichier_copie.img mapfile
AFTER
ddrescue -f /mnt/fichier_copie.img /dev/sdX restorefile
@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 / 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 = "";
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 / nginx-ssl-qualys-100%-A+.vhost
Last active February 26, 2021 07:57
Qualys SSL labs How To get A+ and 100% with Nginx
server {
listen 443 ssl deferred;
server_name example.com;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 24h;
ssl_buffer_size 4k;
ssl_session_tickets off;
ssl_protocols TLSv1.2;
@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