Skip to content

Instantly share code, notes, and snippets.

View antoine-briand's full-sized avatar

Antoine Briand antoine-briand

View GitHub Profile
@antoine-briand
antoine-briand / dropbox-business-account-backup.sh
Created June 21, 2022 21:23
Backup dropbox business accounts using rclone
: '
This script helps me to backup Dropbox business accounts. Requires rclone to be installed on your machine (https://rclone.org/downloads/).
You must create a dropbox application (https://www.dropbox.com/developers/apps) with all READ scopes.
Then configure your rclone using rclone config
1) Choose dropbox
2) Set your remote name
3) On client_id, paste the value you have for "App key" on your Dropbox app (in settings)
4) On client_secret, paste the value you have for "App secret" on your Dropbox app (in settings)
5) Edit advanced config and set a value to the impersonate parameter (your admin account email e.g)
'''
Nous avons deux textes en entrée, texte_a et texte_b qui parlent tous les deux de Labrador (l'un étant une région du Canada et l'autre étant une race de chien).
'''
import re
from tabulate import tabulate
texte_a = '''Le Labrador est la région continentale de la province canadienne de Terre-Neuve-et-Labrador. A ne pas confondre avec la race de chien labrador.'''
texte_b = '''Le retriever du Labrador, plus communément appelé labrador retriever ou plus simplement labrador, est une race de chiens originaire du Royaume-Uni. C'est un chien de taille moyenne, à l'allure ronde et robuste, de couleur entièrement sable, chocolat ou noir. Issu du chien de Saint-John, la race a été importée puis développée au Royaume-Uni et au Canada. Le labrador est actuellement l'une des races les plus répandues dans le monde.'''
@antoine-briand
antoine-briand / client.py
Created March 10, 2017 16:55
python-mongo-reddit
from flask import Flask, jsonify
from flask import request
from bson.json_util import dumps
from flask_cors import CORS
from pymongo import MongoClient
client = MongoClient('mongodb://localhost:27017/')
db = client['reddit']
@antoine-briand
antoine-briand / gsprpsc
Created August 17, 2016 09:26
ZSH Alias : Git push custom command (stash / pull rebase / push / stash apply / stash clear)
alias gsprpsc="git stash && git pull --rebase && git push && git stash apply && git stash clear"
@antoine-briand
antoine-briand / how-to-configure-mailgun-ghost-with-google-cloud
Created August 2, 2016 13:25
I had some trouble setting Mailgun for Ghost (Blog) with a server hosted on google cloud (compute engine). In fact it's really easy. Just replace the mail configuration in config.js with this gist and it's done !
mail: {
transport: 'SMTP',
options: {
service: 'Mailgun',
port: 2525,
auth: {
user: '[email protected]',
pass: 'myMailGunPassword'
}
}
import os
print("LXC-KICKSTART - Ajinov : Network Setting")
ip = raw_input("Entrez l'adresse ip > ")
passerelle = raw_input("Entrez la passerelle > ")
hostname = raw_input("Entrez le hostname > ")
os_type = raw_input("Debian ou Ubuntu ? (0/1) > ")
hostname_file = "/etc/hostname"
interface_file = "/etc/network/interfaces"
@antoine-briand
antoine-briand / imapsync-interactive.py
Last active August 29, 2023 12:39
Interactive ImapSync tool written in python 3. Useful to sync imap accounts across different mail servers. Python 3 and imapsync must be installed on the machine.
# coding: utf8
import os, csv
print("Welcome to the ImapSync interactive")
mode = input("Interactive mode or Read CSV file ? (1/2) ")
if mode == "2":
#host1;user1;password1;host2;user2;password2
file = input("File path : ")
if file:
print("Reading file")
@antoine-briand
antoine-briand / gist:62a35cb6749952fac206
Created November 20, 2015 10:44 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@antoine-briand
antoine-briand / naive_and_aware_datetimes_python
Created November 18, 2013 16:12
To pass through the error "TypeError: can't compare offset-naive and offset-aware datetimes" (Python)
def compare_dates(last_entry):
utc = pytz.UTC
if last_entry.end_time > utc.localize(datetime.datetime.now()):
return True
return False