Skip to content

Instantly share code, notes, and snippets.

@cedricbonhomme
cedricbonhomme / night-troubles.md
Created October 31, 2023 08:22
Night troubles
View night-troubles.md
Photons are dying.
Eyelids are still blinking.
Clock is ticking.
Heart is slowly beating.
Parasites are rising.
Cerebral cells are colliding.
Troubles are spreading.
Ions are crackling.
Soul is screaming.

Brain is throttling.

@cedricbonhomme
cedricbonhomme / proxy_views.py
Created August 23, 2022 06:15 — forked from joeshaw/proxy_views.py
super-hacky flask proxy
View proxy_views.py
# 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
View backup-db.sh
#!/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
View migrate-psql-server.sh
$ 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
View compile-mod-wsgi.sh
# 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
View create_object_mosp.py
#! /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
View 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
View stale.yml
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
View python-environment-2021.sh
# 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
@cedricbonhomme
cedricbonhomme / create-postgreSQL-db.sh
Last active June 10, 2019 09:40
Creation of a PostgreSQL database
View create-postgreSQL-db.sh
sudo -u postgres createuser <username>
sudo -u postgres createdb <database>
sudo -u postgres psql
psql (11.2 (Ubuntu 11.2-1))
Type "help" for help.
postgres=# alter user <username> with encrypted password '<password>';
ALTER ROLE
postgres=# grant all privileges on database <database> to <username>;
GRANT