Skip to content

Instantly share code, notes, and snippets.

@gbaudoin
gbaudoin / Bvr.php
Last active January 2, 2023 09:03
Calcul du chiffe-clé en PHP, modulo 10 récursif, BVR PostFinance Suisse
<?php
/**
* Calcul du chiffre-clé en PHP, modulo 10, récursif BVR Suisse
* Berechnung der Prüfziffer nach Modulo 10, rekursiv BESR Schweiz
* Calculating the Check Digits Using Module 10, Recursively
*
* @author gbaudoin
* @license GPL
* @see https://www.postfinance.ch/content/dam/pf/de/doc/consult/manual/dldata/efin_recdescr_man_fr.pdf
* @see https://gist.github.com/christianmeichtry/9348451
@boekkooi
boekkooi / ConnectionKeepAlive.php
Last active October 19, 2023 23:17
Doctrine keep alive (MySQL server has gone away)
<?php
namespace Acme\Doctrine\DBAL;
use Doctrine\DBAL\Connection;
declare(ticks = 3000000);
class ConnectionKeepAlive
{
/**
@christianmeichtry
christianmeichtry / modulo10.rb
Last active February 19, 2021 02:59
Calcul du chiffre-clé, modulo 10, récursif BVR Suisse
# Calcul du chiffre-clé, modulo 10, récursif BVR Suisse
# Berechnung der Prüfziffer nach Modulo 10, rekursiv BESR Schweiz
# Calculating the Check Digits Using Module 10, Recursively
def modulo10_checksum(number) # Best to send a string, an integer with leading 0's will be interpreted as octal...
# table from https://www.credit-suisse.com/media/production/pb/docs/unternehmen/kmugrossunternehmen/besr_technische_dokumentation_fr.pdf
table = [
[0,9,4,6,8,2,7,1,3,5],
[9,4,6,8,2,7,1,3,5,0],
@PowerKiKi
PowerKiKi / ubuntu_fresh_install_for_user.sh
Last active July 11, 2022 14:19
ubuntu fresh install
# apache+mariadb+php+misc
sudo apt-add-repository ppa:ondrej/php
sudo apt update
sudo apt install vim curl git git-gui gitk htop nginx nginx-extras mariadb-server zip graphicsmagick php-cli php-gd php-xml php-mysql php-sqlite3 php-mbstring php-curl php-imagick php-xml php-zip php-bcmath php-bz2 php-soap php-intl php-apcu php-pcov php-fpm
# wp-cli
wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp