Skip to content

Instantly share code, notes, and snippets.

@boulabiar
boulabiar / 💁‍♀️ Karen Bot by @levelsio
Created January 9, 2026 14:25 — forked from levelsio/💁‍♀️ Karen Bot by @levelsio
💁‍♀️ Karen Bot is an AI robot that lets you report problems in your neighborhood or city to your local city council
<?php
// Karen Bot by @levelsio
//
// ask Claude Code or Cursor to adapt it to your city
// mine is for Lisbon in Portuguese but it should work with any city and any language!
// save it as council.php and add a Nginx route /council on your server to use it
// make sure to add /council?key= and set a key below to use it privately
//
// more info: https://x.com/levelsio/status/2009011216132526407?s=20
@boulabiar
boulabiar / arrange.rs
Created January 31, 2025 16:21 — forked from juancampa/arrange.rs
Force directed algorithm to solve rect overlaps
fn arrange(&self, ui: &mut Ui, state: &mut DashboardState, repulsion_steps: usize, compaction_steps: usize) {
if state.block_rect.is_empty() {
return;
}
let original = state.block_rect.clone();
let mut debug_copy = state.block_rect.clone();
let rects = &mut state.block_rect;
let keys: Vec<BlockKey> = rects.keys().collect();
let keys = keys.iter().copied();
@boulabiar
boulabiar / simple.md
Last active December 13, 2020 00:21
inkscape Dbus

Using systemd dbus

create an ellipse

busctl --user call org.inkscape /org/inkscape/document_0 org.inkscape.document ellipse iiii 0 0 20 40

get list of objects in layer1

busctl --user call org.inkscape /org/inkscape/document_0 org.inkscape.document get_children "s" layer1

@boulabiar
boulabiar / focus.c
Created July 1, 2020 20:59
Get the FocusIn FocusOut events from xcb
// sources:
// https://xcb.freedesktop.org/tutorial/events/
// https://xcb.freedesktop.org/manual/group__XCB____API.html
// https://github.com/wmutils/opt/blob/master/wew.c
//
// compile with:
// gcc focus.c -lxcb
#include <stdlib.h>
#include <stdio.h>
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)
project(demo LANGUAGES CXX)
SET("OpenCV_DIR" "...../opencv4/opencv")
find_package( OpenCV REQUIRED )
MESSAGE(STATUS "Include dirs ${OpenCV_INCLUDE_DIRS}")
MESSAGE(STATUS "LINK LIBRARIES ${OpenCV_LIBS}")
find_package(al-runtime)
# view the desktop into a window on Linux
gst-launch-1.0 ximagesrc startx=1920 use-damage=0 \
! video/x-raw,framerate=30/1 \
! videoscale method=0 \
! video/x-raw,width=1920,height=1080 \
! ximagesink
# view the desktop into a window on MacOS
gst-launch-1.0 avfvideosrc capture-screen=true \
@boulabiar
boulabiar / GLSL-Noise.md
Created February 27, 2017 11:08 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}

Keolis "open-data" : XML Realtime API

Les données retournées sont au format XML.

Document trouvé et modifié depuis Pastebin.

Récupérer la liste des lignes

var casper = require('casper').create();
casper.start('http://www.bibus.fr/horaires-station-navitia.aspx', function() {
this.echo(this.getTitle());
});
casper.run();
// fill form
casper.then(function(){