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
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
@pombredanne
pombredanne / altgzip.py
Created Aug 7, 2019 — forked from nczeczulin/altgzip.py
Ignore gzip trailing garbage during reads.
View altgzip.py
import gzip
import logging
_logger = logging.getLogger(__name__)
# monkey patch for 2.7
import sys
if sys.version_info[:2] == (2, 7):
# ripped from py 3.4 gzip module
# modified for py 2.7 _read()
def read1(self, size=-1):
@pombredanne
pombredanne / docker_pulp_env.sh
Created Aug 2, 2019 — forked from nextrevision/docker_pulp_env.sh
Configures a complete pulp environment with docker-machine
View docker_pulp_env.sh
#!/bin/bash
ACTION=$1
PULP_IMAGES=(
pulp/mongodb
pulp/qpid
pulp/base
pulp/worker
pulp/apache
@pombredanne
pombredanne / gist:1e0450539cf6945b02a79f0b30a6ce39
Created Jul 17, 2019 — forked from bessarabov/gist:674ea13c77fc8128f24b5e3f53b7f094
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
View gist:1e0450539cf6945b02a79f0b30a6ce39
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
View mac.py
# 1. fetch https://github.com/nexB/scancode-toolkit/raw/924f53d5932fcb69acad76d07f60f6b52176b2f5/tests/commoncode/data/fileutils/walk_non_utf8/non_unicode.tgz
# 2. cd to the directory where this is saved and run this:
python -c "import tarfile;tarfile.open(u'non_unicode.tgz').extractall(u'.')"
You can’t perform that action at this time.