Skip to content

Instantly share code, notes, and snippets.

View BertrandBordage's full-sized avatar

Bertrand Bordage BertrandBordage

View GitHub Profile
@mosquito
mosquito / README.md
Last active April 21, 2024 00:42
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@mlorant
mlorant / region-dpts-France.py
Created December 20, 2016 15:24
Liste des régions et départements français (dict. Python)
REGIONS = {
'Auvergne-Rhône-Alpes': ['01', '03', '07', '15', '26', '38', '42', '43', '63', '69', '73', '74'],
'Bourgogne-Franche-Comté': ['21', '25', '39', '58', '70', '71', '89', '90'],
'Bretagne': ['35', '22', '56', '29'],
'Centre-Val de Loire': ['18', '28', '36', '37', '41', '45'],
'Corse': ['2A', '2B'],
'Grand Est': ['08', '10', '51', '52', '54', '55', '57', '67', '68', '88'],
'Guadeloupe': ['971'],
'Guyane': ['973'],
'Hauts-de-France': ['02', '59', '60', '62', '80'],
#!/usr/bin/env python
from argparse import ArgumentParser
from io import BytesIO
import re
from xml.etree import ElementTree
NAMESPACED_RE = re.compile(r'^\{(.+)\}.+$')
SVG_NAMESPACE = 'http://www.w3.org/2000/svg'
@drkarl
drkarl / gist:739a864b3275e901d317
Last active October 17, 2023 10:43
Ask HN: Best Linux server backup system?

Linux Backup Solutions

I've been looking for the best Linux backup system, and also reading lots of HN comments.

Instead of putting pros and cons of every backup system I'll just list some deal-breakers which would disqualify them.

Also I would like that you, the HN community, would add more deal breakers for these or other backup systems if you know some more and at the same time, if you have data to disprove some of the deal-breakers listed here (benchmarks, info about something being true for older releases but is fixed on newer releases), please share it so that I can edit this list accordingly.

  • It has a lot of management overhead and that's a problem if you don't have time for a full time backup administrator.
@pebosi
pebosi / gist:9090062
Created February 19, 2014 11:15
Use parallel to mogrify images
find -iname "*.jpg" -type f -print0 | parallel --progress -0 -j +0 "mogrify -resize 800x800\> {}"
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 22:48
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@akhenakh
akhenakh / gist:3376839
Created August 17, 2012 07:57
negative float for flask
from werkzeug.routing import NumberConverter, ValidationError
class NegativeFloatConverter(NumberConverter):
regex = r'\-?\d+\.\d+'
num_convert = float
def __init__(self, map, min=None, max=None):
NumberConverter.__init__(self, map, 0, min, max)
app.url_map.converters['float'] = NegativeFloatConverter
@justinfx
justinfx / cache_generics.py
Created July 12, 2012 02:17
forwards generic relations
'''
Cache the generic relation field of all the objects
in the queryset, using larger bulk queries ahead of time.
Improved from original by Daniel Roseman:
http://blog.roseman.org.uk/2010/02/22/django-patterns-part-4-forwards-generic-relations/
'''
def cache_generics(queryset):
@paulmillr
paulmillr / active.md
Last active April 23, 2024 17:32
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)