Skip to content

Instantly share code, notes, and snippets.

View r0mdau's full-sized avatar

Romain Dauby r0mdau

View GitHub Profile
@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 / 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"){
@r0mdau
r0mdau / instructions.sh
Last active February 10, 2019 15:19
Cluster Kubernetes using virtualbox with Debian Stretch
##On the first VM
apt-get install -y apt-transport-https ca-certificates curl software-properties-common gnupg2
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt-get update
apt-cache madison docker-ce
apt-get install docker-ce=18.06.0~ce~3-0~debian
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
@r0mdau
r0mdau / gist:7e5100ff175acf954f05e5124c3d3b7d
Last active May 3, 2023 16:13
Match docker overlay directory with container name
df -hi
apt install jq
cd /var/lib/docker/overlay2/
find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
docker inspect $(docker ps -qa) | jq -r 'map([.Name, .GraphDriver.Data.MergedDir]) | .[] | "\(.[0])\t\(.[1])"'
docker ps
docker images
@r0mdau
r0mdau / backup.sh
Created September 7, 2019 17:47
Rsync backup
#!/bin/sh
if [ $(mount | grep -c /media/romain/disk) = 1 ]
then
SOURCE="/home/romain"
ACTUEL="/media/romain/disk/raupi/actuel"
BACKUP="/media/romain/disk/raupi/$(date +'%Y-%m-%d')"
mkdir -p "$BACKUP"
/usr/bin/rsync -av --stats --delete --backup --backup-dir="$BACKUP" "$SOURCE" "$ACTUEL"
rmdir --ignore-fail-on-non-empty $BACKUP
fi
@r0mdau
r0mdau / checksdcard.py
Last active March 21, 2023 08:41
Python script to check raspberry pi SD card health
#!/usr/bin/python3
import os
def writeSomeBytesSucceed(datas):
filepath = "/sdCardTest.raw"
testpattern = bytes(datas)
writer = open(filepath, "wb", buffering=0)
writer.write(testpattern)
writer.close()
@r0mdau
r0mdau / find-k8snode-interface.sh
Last active December 19, 2023 09:01
How to get tcpdump for containers inside Kubernetes pods
# find the kube node of the running pod, appear next to hostIP, and note containerID hash
kubectl get pod mypod -o json
# -> save hostIP
# -> save containerID
# connect to the node and find the pods unique network interface index inside it's container
docker exec containerID /bin/bash -c 'cat /sys/class/net/eth0/iflink'
# -> returns index
# locate the interface of the node
@r0mdau
r0mdau / HFS.md
Last active March 15, 2024 11:50
How to recover pictures and files from failed MacOS / HFS+ hard drive with Linux

How to recover pictures and files from failed MacOS / HFS+ hard drive with Linux

A couple months ago, a friend ask me to repair a failing macintosh.

It appears the hard drive has multiple failures from SMART anlysis.

Next reboot... Oh crap, the operating system does not start anymore. The drive contains 10 years of pictures to recover. A heart pinch :'(

Important thing to know, if (certainely) the disk is crypted and you don't know the principal user login password,

@r0mdau
r0mdau / Dockerfile
Created June 10, 2020 07:06
Ugly Dockerfile for job interview
FROM debian:buster
LABEL name="php7"
LABEL author="test"
RUN apt-get update
RUN apt-get install -y apache2 php7.3
COPY . /app
COPY ./etc/custom.vhost /etc/apache2/sites-enabled/custom.vhost