Skip to content

Instantly share code, notes, and snippets.

@ewiger
ewiger / sql.py
Created June 8, 2016 15:56
added table locking
#! /usr/bin/env python
#
"""
SQL-based storage of GC3pie objects.
"""
# Copyright (C) 2011-2012, 2015 S3IT, Zentrale Informatik, University of Zurich. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@ewiger
ewiger / rename_tiff_folder.py
Created May 26, 2016 14:54
was written this piece of code so often, I decided to put it into a gist
import os
import sys
ROOT = os.path.dirname(os.path.abspath(__file__))
TOKEN = 'No Response Detected'
NEWTOKEN = 'FISH01'
def rename_tiff_folder(tiff_path):
#!/usr/bin/env bash
#
# Postgres-XC Configuration file for pgxc_ctl utility.
#
# Configuration file can be specified as -c option from pgxc_ctl command. Default is
# $PGXC_CTL_HOME/pgxc_ctl.org.
#
# This is bash script so you can make any addition for your convenience to configure
# your Postgres-XC cluster.
#
@ewiger
ewiger / bf_echo.py
Created February 16, 2015 12:45
brainfuck `hello world` echo'er
'''
brainfuck `hello world` echo'er
test in here http://copy.sh/brainfuck/
wbr, yy
'''
from brainfuck import evaluate
def pack(coordinates):
lines = list()
@ewiger
ewiger / ConsoleBasedNativeApi.md
Last active August 29, 2015 14:04
Avoiding alerts in cordova with browser as a client

A "virtualenv activate" for Anaconda environments

I've been using the Anaconda python package from continuum.io recently and found it to be a good way to get all the complex compiled libs you need for a scientific python environment. Even better, their conda tool lets you create environments much like virtualenv, but without having to re-compile stuff like numpy, which gets old very very quickly with virtualenv and can be a nightmare to get correctly set up on OSX.

The only thing missing was an easy way to switch environments - their docs suggest running python executables from the install folder, which I find a bit of a pain. Coincidentally I came across this article - Virtualenv's bin/activate is Doing It Wrong - which desribes a simple way to launch a sub-shell with certain environment variables set. Now simple was the key word for me since my bash-fu isn't very strong, but I managed to come up with the script below. Put this in a text file called conda-work

<?php
/**
* FuzzyDateParser is meerly a "convinience" wrapper around date_parse
* functionality from ext/date/lib/timelib code (which does all the
* scanning and other "fuzzy" guessing work).
*
* @see http://www.php.net/manual/en/function.date-parse.php
* @see http://stackoverflow.com/questions/15350309/heuristic-fuzzy-date-extraction-from-the-string
*
* by Yauhen Yakimovich, 2013
@ewiger
ewiger / matlab.def
Created February 17, 2013 02:18
Somewhat based on python.def MATLAB jsp syntax highlighting for Atlassian Fisheye/Crucible
# MATLAB jsp syntax highlighting for Atlassian Fisheye/Crucible
#
# http://stackoverflow.com/questions/14916809/defining-custom-syntax-highlighting-for-atlassian-fisheye-crucible-matlab
syntaxdef matlab {
# whitespace
/\s+/m : ;
# comments
/%.*?$/m : {