Skip to content

Instantly share code, notes, and snippets.

View cedricbonhomme's full-sized avatar

Cédric Bonhomme cedricbonhomme

View GitHub Profile
@cedricbonhomme
cedricbonhomme / ev3dev-elliot.py
Last active December 9, 2023 10:37
ev3dev with Python and the Mindstorm robot.
#! /usr/bin/env python3
from ev3dev2.led import Leds
from ev3dev2.sound import Sound
from ev3dev2.motor import OUTPUT_B, OUTPUT_C, SpeedPercent, MoveTank
from ev3dev2.sensor.lego import InfraredSensor, TouchSensor
sound = Sound()
leds = Leds()
ts = TouchSensor()
@cedricbonhomme
cedricbonhomme / night-troubles.md
Last active April 18, 2024 12:32
Night troubles

Photons are dying.
Eyelids still blink.
Clock keep ticking.
Heart beat slowly.
Parasites rise.
Cerebral cells collide.
Troubles spread.
Ions crackle.
Soul screams.
Brain throttles.

@cedricbonhomme
cedricbonhomme / proxy_views.py
Created August 23, 2022 06:15 — forked from joeshaw/proxy_views.py
super-hacky flask proxy
# coding:utf-8
# Copyright 2011 litl, LLC. All Rights Reserved.
import httplib
import re
import urllib
import urlparse
from flask import Blueprint, request, Response, url_for
from werkzeug.datastructures import Headers
@cedricbonhomme
cedricbonhomme / backup-db.sh
Last active June 14, 2022 11:30
backup databases
#!/bin/bash
#
# Create a MariaDB user for the backups:
#
# CREATE USER 'backupuser'@localhost IDENTIFIED BY 'password';
# GRANT SELECT ON *.* TO 'backupuser'@'localhost';
# FLUSH PRIVILEGES;
#
# Tested for a MONARC installation:
@cedricbonhomme
cedricbonhomme / migrate-psql-server.sh
Created December 15, 2021 08:21
PostgreSQL server migration
$ locate bin/postgres
/usr/lib/postgresql/10/bin/postgres
/usr/lib/postgresql/12/bin/postgres
/usr/lib/postgresql/9.5/bin/postgres
$ sudo pg_lsclusters
$ mkdir backup-pg
$ sudo cp -R /var/lib/postgresql/9.5 backup-pg
@cedricbonhomme
cedricbonhomme / compile-mod-wsgi.sh
Last active October 17, 2021 16:08
compile, install mod-wsgi and compile Python with shared libraries support
# Configure and install pyenv:
# https://gist.github.com/cedricbonhomme/ababe00d0a675ea5c69d777276e8f375
# Install apxs2:
sudo apt install apache2-dev
# Install Python with shared libraries support:
CONFIGURE_OPTS=--enable-shared pyenv install 3.10.0
@cedricbonhomme
cedricbonhomme / create_object_mosp.py
Last active March 7, 2021 00:39
Example creation of object on MOSP
#! /usr/bin/env python
# -*- coding: utf-8 -
import requests
import uuid
# The JSON object
json_object = {
"authors": ["Consortium GARR [www.garr.it]"],
@cedricbonhomme
cedricbonhomme / check-translations.sh
Last active May 11, 2021 19:41
check-translations.sh
#!/bin/bash
# Defore executing this script you must install curl and jq:
# sudo apt-get install curl jq
set -e
# database user:
@cedricbonhomme
cedricbonhomme / stale.yml
Created July 10, 2020 12:16
Close stale issues
name: "Close stale issues"
on:
schedule:
- cron: "15 4 * * 1,3,5"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
@cedricbonhomme
cedricbonhomme / python-environment-2021.sh
Last active November 24, 2021 13:47
My Python environment for 2021
# Installation of a decent editor, emacs
$ sudo apt install emacs
# Prerequisites to build Python
$ sudo apt install make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev libxml2-dev libxslt-dev libpq-dev python3-openssl