Skip to content

Instantly share code, notes, and snippets.

View arnotae's full-sized avatar

Arnaud Taelman Martini arnotae

View GitHub Profile
@arnotae
arnotae / db_fixture.py
Last active February 11, 2022 15:12 — forked from andgineer/db_fixture.py
pytest Fixture to rollback all DB changes after test
from sqlalchemy import event
from sqlalchemy.orm import sessionmaker
from app.db.session import engine
import pytest
import app.tests.config
@pytest.fixture(
scope='function',
autouse=True # New test DB session for each test, todo we need it only for tests with Client fixture
@arnotae
arnotae / console.py
Last active April 18, 2021 16:11
Python CLI script "stand alone" - MySQL Migration - to include in project
#!/usr/bin/python3
""" Python CLI script "stand alone" - MySQL Migration
Need python-dotenv & mysql-connector-python
Command : python console.py migrate
"""
import os
from argparse import ArgumentParser
@arnotae
arnotae / rocketguide.md
Created July 24, 2020 11:48 — forked from belst/rocketguide.md
Deploy Rocket in production

Deploy Rocket using Letsencrypt and nginx

Information

This guide uses the domain your-domain.tld and its www. prefixed version. It starts the rocket application on 127.0.0.1:1337 and as the user www-data. The proxy listens on port 80 and 443 though.
If you need other values, update them accordingly in your nginx and systemd configs.

Prerequisites

You need to have nginx, certbot and rust installed.

@arnotae
arnotae / Gulpfile.js
Created September 20, 2016 15:13
[Less] Gulpfile.js et package.json par défaut
// Require
var gulp = require('gulp');
var gutil = require('gulp-util');
var notify = require('gulp-notify');
var less = require('gulp-less');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var cleanCSS = require('gulp-clean-css');
var LessPluginAutoPrefix = require('less-plugin-autoprefix');
@arnotae
arnotae / Symfony console .bashrc
Created May 30, 2016 10:00
Alias for Symfony Console in .bashrc
# Console
alias sf="php app/console"
alias sfdev="php app/console --env=dev"
alias sfprod="php app/console --env=prod"
# Helper
alias sf:cc="php app/console cache:clear"
alias sf:gb="php app/console generate:bundle"
alias sf:rd="php app/console router:debug"
alias sf:dsd="php app/console doctrine:schema:update"
@arnotae
arnotae / nginx.conf
Last active July 4, 2016 12:57 — forked from denys281/nginx.conf
Symfony2 nginx virtual host (php-fpm)
server {
listen 80;
# Server name being used (exact name, wildcards or regular expression)
server_name SITE.dev www.SITE.dev;
client_max_body_size 20M;
# Document root, make sure this points to your Symfony2 /web directory
root /var/www/SITE/web;
@arnotae
arnotae / Mailgun & Gandi
Created March 10, 2016 13:12
How to configure mailgun with Gandi DNS
mg 10800 IN A 000.00.00.000 (Ip mailgun)
email.mg 10800 IN CNAME mailgun.org.
mg 10800 IN TXT "v=spf1 include:mailgun.org ~all"
yolo._domainkey.mg 10800 IN TXT "k=rsa; p=XXX" (domainkey & key mailgun)
@arnotae
arnotae / City distance fullquery
Last active May 30, 2016 09:58 — forked from OllieJones/fullquery
Fast nearest-location finder for SQL (MySQL, PostgreSQL, SQL Server)
SELECT zip, primary_city,
latitude, longitude, distance
FROM (
SELECT z.zip,
z.primary_city,
z.latitude, z.longitude,
p.radius,
p.distance_unit
* DEGREES(ACOS(COS(RADIANS(p.latpoint))
* COS(RADIANS(z.latitude))