Skip to content

Instantly share code, notes, and snippets.

@MonsieurV
MonsieurV / monit.output
Created April 23, 2016 21:25
Monit status command ouput
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
@MonsieurV
MonsieurV / imagesToPDF.py
Created November 9, 2016 23:49
PyFPDF -- Images concatenation in PDF file
# 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 / triangle.py
Created November 10, 2016 14:17
My Little Sister Triangle Geometry Problem
# 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 / keybase.md
Created August 3, 2017 14:58
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 / style.css
Created October 13, 2017 15:13
react-dates@13.0.3/css/style.css
.DateRangePicker {
position: relative;
display: inline-block
}
.DateRangePicker_picker {
z-index: 1;
background-color: #fff;
position: absolute
}
.DateRangePicker_picker__rtl {
<?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 / session_middleware.py
Created March 8, 2019 23:40
Django multi-cookie name session
"""
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 / mail_mass_remover.py
Last active May 3, 2019 10:33
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.
"""
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 / example.ovpn
Created September 8, 2019 15:37
How to include or exclude traffic from routing to an OpenVPN connection?
client
dev tun
proto udp
remote X.X.X.X 1194
# ----------------
# Routing configuration pulling
# ----------------
@MonsieurV
MonsieurV / createImageBitmap.js
Last active February 16, 2021 11:04
createImageBitmap polyfill with Blob and ImageData source support
/*
* 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)) {