Skip to content

Instantly share code, notes, and snippets.

@badouralix
badouralix / large.py
Created May 2, 2021 09:58
PoC of an interesting buggy behavior in Python.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
PoC of an intresting buggy behavior in Python.
"""
from pprint import pprint
@badouralix
badouralix / Dockerfile
Last active June 24, 2020 21:44
RPi Garden - small project to take care of Lily
# Build dependencies
FROM python:3.7-alpine AS build
RUN apk update && apk add build-base
COPY requirements.txt /tmp/requirements.txt
RUN pip install --install-option="--prefix=/requirements" --requirement /tmp/requirements.txt
# Build runtime image
FROM python:3.7-alpine
COPY --from=build /requirements /usr/local
COPY garden.py /usr/local/bin/garden
@badouralix
badouralix / .zlogin
Created June 9, 2020 20:58
Fancy zlogin for metamorph
# ~/.zlogin: Personal login commands for zsh.
# This file is sourced only for login shells. It should contain commands
# that should be executed only in login shells. It should be used to set
# the terminal type and run a series of external commands (fortune,
# msgs, from, etc.)
# Global Order: zshenv, zprofile, zshrc, zlogin
#!/bin/bash
#
# Ce script est lancé à la fin de adduser
# Utilisation : adduser.local USER UID GID HOME
print_about() {
cat << EOF
$0 --- adduser(8) local system additions.
@badouralix
badouralix / i-wanna-be-the-root.sh
Created June 9, 2020 20:28
Pwning metamorph the beautiful way
#!/bin/bash
#
# Copyright (C) 2016 Ayaz BADOURALY
#
# This work is free. You can redistribute it and/or modify it under the terms of
# the Do What The Fuck You Want To Public License, Version 2, as published by Sam
# Hocevar. See the COPYING file or http://www.wtfpl.net/ for more details.
#
set -e
docker run -it --rm -v $PWD:/etc/letsencrypt/ certbot/certbot certonly \
--manual \
--server https://acme-staging-v02.api.letsencrypt.org/directory \
--register-unsafely-without-email \
--agree-tos \
--manual-public-ip-logging-ok \
-d example.com -d '*.example.com'
@badouralix
badouralix / electron-spawn-delay-demo.patch
Created January 28, 2019 03:27
Timeit electron-spawn-delay-demo
diff --git a/src/renderer.js b/src/renderer.js
index 6582d5d..ef9d1ac 100644
--- a/src/renderer.js
+++ b/src/renderer.js
@@ -1,9 +1,16 @@
// import { spawn } from "child_process";
const cp = require('child_process')
const { spawn } = cp
+const fs = require('fs')
@badouralix
badouralix / mutable-dict-keys.py
Created January 2, 2019 20:50
PoC of an interesting buggy behavior in Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PoC of an interesting buggy behavior in Python. Also works in python2.
$ ./mutable-dict-keys.py
{Mutable(0): 'value'} is consistent
{Mutable(1): 'value'} is not consistent
"""
@badouralix
badouralix / default.conf
Last active October 21, 2017 17:09
Docker nginx:alpine configuration for vue-router in HTML5 mode
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ @rewrites;
@badouralix
badouralix / libinput-gestures.conf
Created July 28, 2017 19:14
Awesome libinput-gestures config file
# Configuration file for libinput-gestures
# Lines starting with '#' and blank lines are ignored.
# At present only gesture lines are configured in this file.
#
# Each gesture: line has 3 [or 4] arguments: