Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍
🎹 🏴󠁧󠁢󠁳󠁣󠁴󠁿

Cedric cedricbonhomme

🐍
🎹 🏴󠁧󠁢󠁳󠁣󠁴󠁿
View GitHub Profile
@cedricbonhomme
cedricbonhomme / backup-db.sh
Last active Jun 14, 2022
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 Dec 15, 2021
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 Oct 17, 2021
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 Mar 7, 2021
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]"],
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 Jul 10, 2020
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 Nov 24, 2021
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 Jun 10, 2019
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
@cedricbonhomme
cedricbonhomme / python-environment-2019.sh
Last active Dec 15, 2019
My Python environment for 2019
View python-environment-2019.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 python-openssl
# Installation of pyenv
$ curl https://pyenv.run | bash
View newspipe-on-heroku.sh
# Run this script with one argument:
# ./newspipe-heroku.sh <name-of-your-newspipe-instance>
HEROKU_APP_NAME=$1
git clone https://github.com/newspipe/newspipe.git
cd newspipe/
heroku create $HEROKU_APP_NAME
heroku addons:add heroku-postgresql:hobby-dev
heroku config:set HEROKU=1