Skip to content

Instantly share code, notes, and snippets.

View antoinebou12's full-sized avatar
👨‍💻

Antoine Boucher antoinebou12

👨‍💻
View GitHub Profile
@antoinebou12
antoinebou12 / plantuml_server_url_decode.py
Created April 4, 2023 20:16 — forked from ryardley/plantuml_server_url_decode.py
plantuml server url decoder encoder
# https://plantuml.com/text-encoding
# https://github.com/dougn/python-plantuml/blob/master/plantuml.py#L64
import zlib
import base64
maketrans = bytes.maketrans
plantuml_alphabet = string.digits + string.ascii_uppercase + string.ascii_lowercase + '-_'
base64_alphabet = string.ascii_uppercase + string.ascii_lowercase + string.digits + '+/'
@antoinebou12
antoinebou12 / callus2.js
Last active December 8, 2022 23:25
3cx fix
/*!VERSION: "5.3.255", BUILD_DATE: "2022-09-19T07:31:34.542Z", BUILD_NUMBER: "255", DEV: false*/ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.callus=t():e.callus=t()}(self,()=>(()=>{var leafPrototypes,getProto,__webpack_modules__={4537(e){"use strict";e.exports=function(e,t){for(var n=Array(arguments.length-1),i=0,a=2,r=!0;a<arguments.length;)n[i++]=arguments[a++];return new Promise(function(a,o){n[i]=function(e){if(r){if(r=!1,e)o(e);else{for(var t=Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];a.apply(null,t)}}};try{e.apply(t||null,n)}catch(s){r&&(r=!1,o(s))}})}},7419(e,t){"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var i=Array(64),a=Array(123),r=0;r<64;)a[i[r]=r<26?r+65:r<52?r+71:r<62?r-4:r-59|43]=r++;n.encode=function(e,t,n){for(var a,r=null,o=[],s=0,l=0;t<n;){va
@antoinebou12
antoinebou12 / docker-compose.yml
Created November 2, 2022 01:46
mongodb template docker-compose
version: '3.9'
services:
mongodb_container:
image: mongo:latest
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: rootpassword
ports:
- 27017:27017
volumes:
@antoinebou12
antoinebou12 / sort_mkdir.sh
Last active September 3, 2020 23:41
Bash sort your files in alphabetize folder in dir
#!/usr/bin/env bash
for letter in {0..9} {a..z};
do
files_array=()
if [ $(find "$1" -maxdepth 1 -type f -iname "$letter*" -print0| wc -c) -ne 0 ]; then
mkdir "$1""$(printf '%s\n' "$letter" | awk '{ print toupper($0) }')" > /dev/null
set +m
shopt -s lastpipe
find "$1" -maxdepth 1 -type f -iname "$letter*" -print0 | while IFS= read -r -d $'\0'; do files_array+=("$REPLY"); done; declare -p files_array > /dev/null
@antoinebou12
antoinebou12 / djangoViewFile.py
Last active August 15, 2019 00:49
Django xlsxWriter view and Jquery download xlsx client side
def export_xlsx(request):
response = HttpResponse(content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
response['Content-Disposition'] = 'attachment; filename="{}"'.format(self._fname)
# Excel configuration
# TODO add more formatting
workbook = xlsxwriter.Workbook(response, {'in_memory': True})
worksheet = workbook.add_worksheet(self._sheet_name)
bold = workbook.add_format({'bold': True})
row = 1
@antoinebou12
antoinebou12 / Xlib_Screen.py
Created June 24, 2018 18:04
Xlib python example that display all the screen and resolution
import os
from Xlib import display
d = display.Display()
s = d.screen().root
output = os.popen("xrandr --listmonitors | grep '*' | awk {'print $4'}").read().splitlines()
num_sc = s.xinerama_get_screen_count().screen_count
width = s.get_geometry().width
height = s.get_geometry().height
print("Total count screens: %s" % num_sc)
for i in range(num_sc):
@antoinebou12
antoinebou12 / rebase-git-i.sh
Last active June 18, 2018 14:43
Good rebase on master and flake8 check for python project
#!/bin/bash
function confirm() {
# call with a prompt string or use a default
read -r -p "$(echo -e $1) Are you sure? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
true
;;
*)
false
@antoinebou12
antoinebou12 / select-virtualenv.sh
Last active March 20, 2019 14:28
Select virtualenv for python virtualenv in a directory
#!/bin/bash
# Exemple
# Choose your virtualenv for crispml:
# 1 reader
# 2 curses
# 3 twisted
function select_virtenv() {
echo "$1"