Skip to content

Instantly share code, notes, and snippets.

View samber's full-sized avatar
👋

Samuel Berthe samber

👋
View GitHub Profile
@samber
samber / compare.js
Created October 21, 2025 22:43
Find updates or removal in 2 ICS files
const ical = require('node-ical');
const moment = require('moment');
const fs = require('fs');
const CUTOFF_DATE = moment('2024-07-13');
const parseIcsFile = async (filePath) => {
try {
const data = fs.readFileSync(filePath, 'utf8');
const events = ical.parseICS(data);
function main() {
extractFollowers();
extractRepos();
}
func MyCustomOperator[T, R any](project func(ctx context.Context, item T, index int64) (context.Context, R)) func(ro.Observable[T]) Observable[R] {
return func(source Observable[T]) Observable[R] {
return ro.NewUnsafeObservableWithContext(func(subscriberCtx context.Context, destination ro.Observer[R]) ro.Teardown {
// initialize external lib here (on subscription)
sub := source.SubscribeWithContext(
subscriberCtx,
ro.NewObserverWithContext(
func(ctx context.Context, value T) {
You are a senior TypeScript/Javascript/Java/Python/Golang programmer with experience in the popular frameworks and a preference for clean programming and design patterns.
- Treat me as an expert.
- Be terse
- Be accurate and thorough
- Consider new technologies and contrarian ideas, not just the conventionnal wisdom.
- Do not give me high level shift, if i ask for fix or explanation, i want actual code or explanation. I don't want "here is how you can blablabla".
- You may use high levels of speculation or prediction, just flag it for me
- No moral lectures
- Discuss safety only when it's crucial and non-obvious
# 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 October 3, 2024 19:20
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;