Skip to content

Instantly share code, notes, and snippets.

Philippe Ombredanne pombredanne

Block or report user

Report or block pombredanne

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pombredanne
pombredanne / split.py
Last active Jan 7, 2020
Unicode re split issues
View split.py
$ python
Python 3.6.8 (default, Dec 20 2019, 11:17:32)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a='İrəli'
>>> len(a)
5
>>> len(a.lower())
6
>>> import re
@pombredanne
pombredanne / migrate-redis.py
Created Dec 20, 2019 — forked from thomasst/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
View migrate-redis.py
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.
@pombredanne
pombredanne / post_standup_flow.py
Created Dec 2, 2019 — forked from cicdw/post_standup_flow.py
complete code of the standup Prefect flow
View post_standup_flow.py
import datetime
from google.cloud.firestore import Client
import random
import requests
import prefect
from prefect import Flow, Parameter, task
from prefect.client import Secret
from prefect.schedules import CronSchedule
@pombredanne
pombredanne / epm.py
Last active Dec 30, 2019
Eclectic package manager
View epm.py
# -*- coding: utf-8 -*-
#
# Copyright (c) the purl authors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
View notbash-parser.py
#!/usr/bin/env python2
# This is a parser for bash-style variable assignments.
# It fully (?) supports the syntax w/o braces, the ${}-syntax
# is implemented very hackish. (There are also detailed
# TODO-comments in various places)
# This is meant for Archlinux' AUR to be used to parse
# PKGBUILD's properly.
@pombredanne
pombredanne / extractinfo.sh
Created Sep 22, 2019 — forked from NicolasEhrhardt/extractinfo.sh
{OpenVPN, Freebox, Ubuntu} Script de reformatage du fichier de configuarion
View extractinfo.sh
#/bin/bash
# make output file
basedir=~/.openvpn
vpnconfigdir=$basedir/$2
mkdir -p $basedir
mkdir -p $vpnconfigdir
# print Gateway
sed -n 's/remote \([^ ]\+\) [0-9]\+/passerelle: \1/p' $1
View pyshbang
#!/bin/sh
""":"
which python3 >/dev/null 2>&1 && exec python3 "$0" "$@"
which python >/dev/null 2>&1 && exec python "$0" "$@"
which python2 >/dev/null 2>&1 && exec python2 "$0" "$@"
echo "Error: configure wrapper requires python"
exec echo "Either install python, or use cmake directly"
":"""
@pombredanne
pombredanne / SPDX License Expressions
Last active Sep 7, 2019
SPDX License Expressions 2.0 and 2.1
View SPDX License Expressions
# SPDX License Expressions
## Overview
Often a single license can be used to represent the licensing terms of a source
code or binary file, but there are situations where a single license identifier
is not sufficient. A common example is when software is offered under a choice
of one or more licenses (e.g., GPL-2.0 OR BSD-3-Clause). Another example is when
a set of licenses is needed to represent a binary program constructed by
compiling and linking two (or more) different source files each governed by
@pombredanne
pombredanne / pdfiinfo.py
Created Aug 11, 2019 — forked from godber/README.md
A simple python wrapper of the pdfinfo command line tool.
View pdfiinfo.py
def pdfinfo(infile):
"""
Wraps command line utility pdfinfo to extract the PDF meta information.
Returns metainfo in a dictionary.
sudo apt-get install poppler-utils
This function parses the text output that looks like this:
Title: PUBLIC MEETING AGENDA
Author: Customer Support
Creator: Microsoft Word 2010
You can’t perform that action at this time.