Skip to content

Instantly share code, notes, and snippets.

# timestamp is ignored, since we use a very large token validity: 1000000000.
(
lower(http.request.headers["x-screeb-hmac-digest"][0]) eq “hmac-sha256-base64”
)
and
(
is_timed_hmac_valid_v0(
@samber
samber / README.md
Last active July 26, 2022 09:42
GPX Via Ferrata Ivano Debona (Cortina)

GPX Via Ferrata Ivano Debona (Cortina)

As of 2022-07-18.

  • use the chair lift from Rio Gere car park, up to San Fonca Rif
  • climb 700m D+ to the start of Via Ferrata
  • ~5km of Via Ferrata (the best part is the first kilometer)
  • go down into the valley
  • go along the mountain, through the small forest, to the San Fonca Rif (150m D+)
  • use the chair lift if opened, or follow the ski track to walk down to the car park
@samber
samber / INJECT-JS.md
Last active January 22, 2021 17:05
Inject JS into web page

How-to

Using the Chrome developer console

Just copy paste into the console:

(function(){
  s=document.createElement('script');
 s.type='text/javascript';
@samber
samber / README.md
Last active October 20, 2020 08:59
Postgresql query to Google Spreadsheet

Export Postgresql data to Spreadsheet

Dependencies

psql + jq

Export from PG

export SQL_QUERY="SELECT firstname, lastname, email FROM users"
@samber
samber / README.md
Last active June 22, 2020 21:33
Time-machine with restic

Time-machine with restic

Features

  • Differential backups
  • Deduplication
  • Encrypted ❤️
  • Backup cleaning
  • Less than 1€ a month
const PDFJS = require('pdfjs-dist');
PDFJS.disableTextLayer = false;
PDFJS.disableWorker = true;
function getText(pdfUrl, fromPage=0, nbrPages=-1){
var pdf = PDFJS.getDocument(pdfUrl);
return pdf
.then(function(pdf) { // get all pages text
var maxPages = pdf._pdfInfo.numPages;

Exercices

Hello world

1- Compiler un programme C++ avec un main.cpp

2- Créer une variable msg de type std::string ayant pour valeur “Hello world”, puis l'afficher sur stdout (façon C++).

3- Aficher la longueur de la chaine

@samber
samber / __DEBIAN_QUICK_SETUP__
Last active December 7, 2022 20:16
Debian quick setup
# Quick debian install scripts
@samber
samber / yolo.sh
Created November 29, 2019 11:30
Whatthecommit bash function
function yolo() {
local COLUMNS=10
while true; do
CHOICE_A=$(curl -s whatthecommit.com/index.txt)
CHOICE_B=$(curl -s whatthecommit.com/index.txt)
CHOICE_C=$(curl -s whatthecommit.com/index.txt)
select MSG in ${CHOICE_A} ${CHOICE_B} ${CHOICE_C} other
do
@samber
samber / renderers.php
Last active November 25, 2019 22:54
moodle add teams link
require_once($CFG->dirroot.'/mod/scheduler/renderer.php');
class theme_adaptable_mod_scheduler_renderer extends mod_scheduler_renderer {
public function render_scheduler_student_list(scheduler_student_list $studentlist) {
$o = '';
$toggleid = html_writer::random_id('toggle');
if ($studentlist->expandable && count($studentlist->students) > 0) {
$this->page->requires->yui_module('moodle-mod_scheduler-studentlist',
'M.mod_scheduler.studentlist.init',
array($toggleid, (boolean) $studentlist->expanded) );