Instantly share code, notes, and snippets.

// 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
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")
"""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']
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,
import logging
import requests
SERVER = 'my-jenkins'
JOB_FILTER = 'test'
API_TOKEN = '<my-jenkins-api-token>'
USER = 'glombard'
import logging
import datetime
import time
from dateutil import tz
import matplotlib.pyplot as plt
import pytz
import requests
# 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
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
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 ->
find /var/folders -name '*robolectric*' | xargs rm -Rf
rm -Rf ~/.m2
rm -Rf ~/.gradle/caches