Skip to content

Instantly share code, notes, and snippets.

Gert Lombard glombard

Block or report user

Report or block glombard

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
// Created by Lawrence PC Dol. Released into the public domain.
// Contributions by Carlos Gómez of Asturias, Spain, in the area of unary operators
// and right-to-left evaluations proved invaluable to implementing these features.
// Thanks Carlos!
// Source is licensed for any use, provided this copyright notice is retained.
// No warranty for any purpose whatsoever is implied or expressed. The author
// is not liable for any losses of any kind, direct or indirect, which result
glombard /
Created May 4, 2016
Parse a Markdown doc using mistune
from __future__ import print_function
from collections import namedtuple
from mistune import Markdown
text = """"
# Sample using mistune to parse images from Markdown pages.
* This is a sample image: ![Alt text](/path/to/img.jpg "Optional title")
glombard /
Last active Apr 16, 2016
Copy photos from my Android phone's SD card. Skip files that already exist locally.
"""Copy photos from my Android phone's SD card. Skip files that already exist locally.
from __future__ import print_function
import subprocess
import csv
import os
photos_dirs = ['/storage/external_SD/DCIM/Camera', '/sdcard/DCIM/Camera']
glombard / curl_exit_codes.json
Created Jan 13, 2016
Python script to generate json file and shell script with curl exit codes
View curl_exit_codes.json
"description": "All fine",
"code": 0,
"name": "CURLE_OK",
"long_description": "All fine. Proceed as usual.\n"
"description": "The URL you passed to libcurl used a protocol that this libcurl does not support",
"code": 1,
glombard /
Created Oct 27, 2015
Backup the config.xml of Jenkins jobs using the REST API
import logging
import requests
SERVER = 'my-jenkins'
JOB_FILTER = 'test'
API_TOKEN = '<my-jenkins-api-token>'
USER = 'glombard'
glombard /
Last active Jan 31, 2020
Plot a graph of Jenkins job build durations over time
import logging
import datetime
import time
from dateutil import tz
import matplotlib.pyplot as plt
import pytz
import requests
glombard /
Created Oct 25, 2015
Querying JSON in Python using Jinja2
# Experimenting with one easy way to query a JSON document using a text query
# similar to how XPath works for XML docs.
# Jinja2 has a powerful expression syntax for evalulating/querying a Python dict.
# In this case, we want to query Maven Central to determine if the latest
# version of Robolectric is 3.0 ...
import requests
from jinja2 import Environment
glombard / build-robolectric.gradle
Created Oct 7, 2015 — forked from kotucz/build-robolectric.gradle
Robolectric runtime dependencies downloader
View build-robolectric.gradle
* Module that includes this will be configured to use offline dependencies for Robolectric
* This downloads robolectric dependencies once into the root project
def robolectricDependenciesFolder = rootProject.buildDir.path + "/robolectric-dependencies"
// configuration that resolves Robolectric runtime dependencies
glombard / my-job-generator.groovy
Created Sep 25, 2015
Using Jenkins Job-DSL plugin to create a job with a Post-Build Step / publisher plugin
View my-job-generator.groovy
job('my-generated-job') {
description('This job was automatically generated by a Job-DSL seed job')
steps {
shell('echo Testing Job-DSL and log-parser')
wrappers {
// Use configure to add the 'publishers' XML node in the generated config.xml
configure { project ->
glombard /
Created May 14, 2015
Clean the gradle/maven and robolectric cache files
find /var/folders -name '*robolectric*' | xargs rm -Rf
rm -Rf ~/.m2
rm -Rf ~/.gradle/caches
You can’t perform that action at this time.