This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/perl | |
# Convertit un ring group de peers en ring group de local | |
my ($str, $suffix) = @ARGV; | |
if (not defined $str) { | |
die "Ring group string missing\n"; | |
} | |
if (not defined $suffix) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/perl | |
# Compte le nombre d'extension unique à faire sonner dans un ring group. | |
my ($str, $suffix) = @ARGV; | |
if (not defined $str) { | |
die "Ring group string missing\n"; | |
} | |
if (not defined $suffix) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============ Fichier de configuration d'apache ==================== | |
<Directory> | |
SSLCertificateFile /etc/pki/tls/certs/mydomain.com.pem | |
SSLCertificateKeyFile /etc/pki/tls/private/mydomain.com.key | |
SSLCACertificateFile /etc/pki/tls/certs/domain-ca.pem | |
</Directory> | |
================ Conversion du PFX pour Apache ==================== | |
openssl pkcs12 -in filename.pfx -nocerts -out mydomain.com.privatekey.pem | |
openssl pkcs12 -in filename.pfx -clcerts -nokeys -out /etc/pki/tls/certs/mydomain.com.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_str2int(src): | |
tab = [] | |
for val in src.split(","): | |
try: | |
tab.append(int(val)) | |
except (ValueError, TypeError): | |
pass | |
return tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import sys | |
def province_by_postal_code(postal_code): | |
pc = postal_code.replace(" ", "").replace("-", "").upper() | |
if not re.match(r"^([ABCEGHJKLMNPRSTVXY]\d)" | |
r"([ABCEGHJKLMNPRSTVWXYZ]\d){2}$", pc): | |
return "<INVALID>" # Invalid, 6 characters required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
myfile="" | |
usage() | |
{ | |
echo "usage: [[-f, --file FILENAME] [SITENAME...] | -h, --help]" | |
} | |
check() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(12)) | |
''.join(random.choices(string.ascii_lowercase + string.ascii_uppercase + string.digits, k=3)) | |
def hash_str(s): | |
"""Get the int hash value of a string.""" | |
modulo = 0x100000001b3 | |
myhash = 0 | |
for ch in bytearray(s.encode('utf-8')): | |
myhash = (31 * myhash + ch) % modulo | |
return myhash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import os | |
from django.conf import settings | |
from django.contrib.sites.models import Site | |
RE_HTTPS = re.compile(r"^https?://") | |
STAGE = os.getenv('STAGE', 'local').lower() | |
def get_site_url(request=None, path=None, *args): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import Http404 | |
from django.utils.translation import ugettext_lazy as _ | |
from django.contrib.auth.mixins import LoginRequiredMixin | |
from django.contrib import messages | |
from django.views.generic import FormView | |
from django.core.urlresolvers import reverse | |
class ProfileFormView(LoginRequiredMixin, FormView): | |
template_name = 'template.html' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...] | |
RUN apt update && apt install -y --no-install-recommends libgdal20 | |
[...] |
NewerOlder