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
View MathEval.java
// Created by Lawrence PC Dol. Released into the public domain.
// http://tech.dolhub.com
//
// 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
glombard / parse_markdown_images.py
Created May 4, 2016
Parse a Markdown doc using mistune
View parse_markdown_images.py
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
glombard / backup_phone_photos.py
Last active Apr 16, 2016
Copy photos from my Android phone's SD card. Skip files that already exist locally.
View backup_phone_photos.py
"""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
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
glombard / jenkins-backup-job-config.py
Created Oct 27, 2015
Backup the config.xml of Jenkins jobs using the REST API
View jenkins-backup-job-config.py
import logging
import requests
logging.captureWarnings(True)
SERVER = 'my-jenkins'
JOB_FILTER = 'test'
API_TOKEN = '<my-jenkins-api-token>'
USER = 'glombard'
@glombard
glombard / jenkins-build-duration-graph.py
Last active May 7, 2019
Plot a graph of Jenkins job build durations over time
View jenkins-build-duration-graph.py
import logging
import datetime
import time
from dateutil import tz
import matplotlib.pyplot as plt
import pytz
import requests
logging.captureWarnings(True)
@glombard
glombard / jinja_json_test.py
Created Oct 25, 2015
Querying JSON in Python using Jinja2
View jinja_json_test.py
# 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
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
configurations.create('robolectricRuntime')
@glombard
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 {
colorizeOutput('xterm')
}
// Use configure to add the 'publishers' XML node in the generated config.xml
configure { project ->
@glombard
glombard / clean_caches.sh
Created May 14, 2015
Clean the gradle/maven and robolectric cache files
View clean_caches.sh
find /var/folders -name '*robolectric*' | xargs rm -Rf
rm -Rf ~/.m2
rm -Rf ~/.gradle/caches
You can’t perform that action at this time.