Skip to content

Instantly share code, notes, and snippets.

@MonsieurV
MonsieurV / example.ovpn
Created Sep 8, 2019
How to include or exclude traffic from routing to an OpenVPN connection?
View example.ovpn
client
dev tun
proto udp
remote X.X.X.X 1194
# ----------------
# Routing configuration pulling
# ----------------
@MonsieurV
MonsieurV / session_middleware.py
Created Mar 8, 2019
Django multi-cookie name session
View session_middleware.py
"""
This is a variation of Django default SessionMiddleware middleware
to allow to resolve different cookie name following our own logic.
For e.g., you could set a different cookie name following the
HTTP path. (You could as well do the same with the host and/or referer)
Beware that this has side-effects if you uses
```
CSRF_USE_SESSIONS = True
@MonsieurV
MonsieurV / createImageBitmap.js
Last active Feb 16, 2021
createImageBitmap polyfill with Blob and ImageData source support
View createImageBitmap.js
/*
* Safari and Edge polyfill for createImageBitmap
* https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
*
* Support source image types Blob and ImageData.
*
* From: https://dev.to/nektro/createimagebitmap-polyfill-for-safari-and-edge-228
* Updated by Yoan Tournade <yoan@ytotech.com>
*/
if (!('createImageBitmap' in window)) {
View pi_barcode.php
<?php
// ******************************************************** 2013 Pitoo.com *****
// ***** CODES A BARRES - Php script *****
// *****************************************************************************
// ***** (c) 2002 - pitoo.com - mail@pitoo.com *****
// *****************************************************************************
// *****************************************************************************
// ***** Ce script est "FREEWARE", il peut etre librement copie et reutilise
// ***** dans vos propres pages et applications. Il peut egalement etre modifie
@MonsieurV
MonsieurV / style.css
Created Oct 13, 2017
react-dates@13.0.3/css/style.css
View style.css
.DateRangePicker {
position: relative;
display: inline-block
}
.DateRangePicker_picker {
z-index: 1;
background-color: #fff;
position: absolute
}
.DateRangePicker_picker__rtl {
View keybase.md

Keybase proof

I hereby claim:

  • I am monsieurv on github.
  • I am yoant (https://keybase.io/yoant) on keybase.
  • I have a public key ASDptqY0mO7MsNS0JrYEfZAC14InNXwkSFreZ9HY1y-d_wo

To claim this, I am signing this object:

@MonsieurV
MonsieurV / mail_mass_remover.py
Last active May 3, 2019
This script simply mass delete mails from a mailbox through a POP3 access. May be useful when you want to clear an Inbox of spams & all.
View mail_mass_remover.py
"""
This script simply mass delete mails from a mailbox
through a POP3 access.
May be useful when you want to clear an Inbox of spams & all.
** CAUTION ** After you have selected the number of messages to delete and pressed
Enter, it really does begin to delete the emails in a permanent way. (Without passing by a trash folder)
Note: the removal is actual when the script close the POP3 connection
@MonsieurV
MonsieurV / triangle.py
Created Nov 10, 2016
My Little Sister Triangle Geometry Problem
View triangle.py
# The objective was to find all possible triangles
# that can have the sum of their three sides sizes equal to 10.
# (We consider only integer side sizes).
#
# I'm not good at Maths, and it was no obvious to
# enumarate all solutions, so I just wrote a program
# to do it for me.
eq_solutions = []
problem_solutions = []
y = 10
@MonsieurV
MonsieurV / imagesToPDF.py
Created Nov 9, 2016
PyFPDF -- Images concatenation in PDF file
View imagesToPDF.py
# Code from http://stackoverflow.com/a/27327984/1956471
from fpdf import FPDF
pdf = FPDF('P', 'mm', 'A4')
for image in ['file1.jpg', 'file2.jpg', 'file3.jpg', 'file4.jpg', 'file5.jpg']:
pdf.add_page()
# Take full page.
# Doc. https://pyfpdf.readthedocs.io/en/latest/reference/image/index.html
pdf.image(image, 0, 5, 210)
pdf.output("output.pdf", "F")
@MonsieurV
MonsieurV / monit.output
Created Apr 23, 2016
Monit status command ouput
View monit.output
The Monit daemon 5.9 uptime: 8m
Process 'radbox-web'
status Running
monitoring status Monitored
pid 17910
parent pid 1
uid 0
effective uid 0
gid 0