Skip to content

Instantly share code, notes, and snippets.

View dan-blanchard's full-sized avatar

Dan Blanchard dan-blanchard

View GitHub Profile
@dan-blanchard
dan-blanchard / create_single_machine_sge.md
Last active March 20, 2022 10:40
How to setup a single-machine (Sun) Grid Engine installation for unit tests on Travis-CI

I recently needed a way to run unit tests on Travis for a project that uses Sun Grid Engine, Grid Map. Unfortunately, it seemed like no one had figured out how to set that up on Travis before (or simply create a single-machine installation without any user interaction). After hours of trial-and-error, I now know the secrets to making a single-machine installation of SGE that runs on Travis, and I'm sharing my script to prevent other people from going through the same frustrating experience.

To use the install_sge.sh script below, you just need to copy all of the files in this gist to a travis sub-directory directly under the root of your GitHub project, and add the following lines to your .travis.yml

before_install:
  - travis/install_sge.sh
  - export SGE_ROOT=/var/lib/gridengine
  - export SGE_CELL=default
  - export DRMAA_LIBRARY_PATH=/usr/lib/libdrmaa.so.1.0
@dan-blanchard
dan-blanchard / fix_timestamps.py
Created September 29, 2013 16:38
Script to fix timestamps of files based on filenames. Default filename regular expression looks for filenames named by CameraSync. I developed this to fix an annoying issue where timestamps were wrong for files uploaded from my iPhone, which made Aperture/iPhoto sort them incorrectly (because videos don't have EXIF data).
#!/usr/bin/env python
'''
Little script to set timestamps based on filenames for files uploaded to
Dropbox by CameraSync.
:author: Dan Blanchard
:date: September, 2013
'''
from __future__ import print_function, unicode_literals
@dan-blanchard
dan-blanchard / .1.miniconda.md
Last active December 11, 2019 22:38
Quicker Travis builds that rely on numpy and scipy using Miniconda

For ETS's SKLL project, we found out the hard way that Travis-CI's support for numpy and scipy is pretty abysmal. There are pre-installed versions of numpy for some versions of Python, but those are seriously out of date, and scipy is not there are at all. The two most popular approaches for working around this are to (1) build everything from scratch, or (2) use apt-get to install more recent (but still out of date) versions of numpy and scipy. Both of these approaches lead to longer build times, and with the second approach, you still don't have the most recent versions of anything. To circumvent these issues, we've switched to using Miniconda (Anaconda's lightweight cousin) to install everything.

A template for installing a simple Python package that relies on numpy and scipy using Miniconda is provided below. Since it's a common s

@hyamamoto
hyamamoto / vimdiff.md
Created December 4, 2013 08:16
The vimdiff cheat sheet as a git mergetool.

vimdiff cheat sheet

This is a vimdiff cheat sheet as a git mergetool.

Commands

]c - go to next difference 
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="""
I never freaking remember argparse syntax and the docs are so all over the place
that I need this for an example.
@sguillope
sguillope / bamboo_delete_disabled_branches.sh
Last active January 1, 2023 15:28
Script to delete all disabled branches of a Bamboo build plan.
#!/bin/bash -u
# Deletes all disabled branches of a Bamboo build plan
# -----------------------------------------------------------------------------
# Syntax:
# $0 {planKey}
# -----------------------------------------------------------------------------
# Purpose: Bamboo does not automatically delete plan branches when the
# corresponding branch in the repository gets deleted. Because Bamboo fails
# to pull from it, it disables the branch but keep it around forever.
# This script goes through all branches of a build plan and delete the ones
@juliantaylor
juliantaylor / pygil.stp
Created September 22, 2015 23:04
python gil stap
# stap -g pygil.stp <pid> <minlocktime-in-mus>
global init = 0
global gpid = $1
global lock_start = 0
global mintime = $2
# may need to be libpython on some systems
probe process("/usr/bin/python-dbg").function("PyThread_acquire_lock")
{
if (init == 0) {
@topiaruss
topiaruss / pytest.ini
Last active June 21, 2016 15:57
Experimenting with minimal test frameworks for spout and bolt
[pytest]
python_paths = src/bolts src/spouts
testpaths = src/tests
@pwlin
pwlin / gist:8a0d01e6428b7a96e2eb
Last active May 4, 2024 07:08
Android : add cert to system store
https://code.google.com/p/android/issues/detail?id=32696#c5
If you have a certificate that is not
trusted by Android, when you add it, it goes in the personal cert store.
When you add a cert in this personal cert store, the system requires a
higher security level to unlock the device. But if you manage to add your
cert to the system store then you don't have this requirement. Obviously,
root is required to add a certificate to the system store, but it is quiet
easy.