Skip to content

Instantly share code, notes, and snippets.

View fish2000's full-sized avatar
👉
My Python work is on the Mars helicopter, and ubiquitous on earth, and more!!!!

Alexander Böhn fish2000

👉
My Python work is on the Mars helicopter, and ubiquitous on earth, and more!!!!
  • Objects in Space and Time, LLC
  • Baltimore, MD
  • 04:49 (UTC -04:00)
  • X @fish2000
View GitHub Profile
@epoz
epoz / ntriple2bibjson.py
Created June 14, 2012 08:23
Converting DNB Bibliography ntriples to BibJSON
import sys
import json
import ntriples
import time
from datetime import datetime
import httplib
ES_URL = "localhost:9200"
ES_PATH = "/bibserver/"
@uri
uri / bitbucket-import.rb
Created June 25, 2012 23:02
Import public repos from Bitbucket to Github
require 'httparty'
class Github
include HTTParty
base_uri "https://api.github.com"
BaseDirectory = "/Users/ugorelik/programming/repos"
def initialize(u, p)
@auth = { username: u, password: p}
load_bitbucket_repos
@pmclanahan
pmclanahan / fields.py
Created July 3, 2012 13:27
A Compressed JSON Field for Django.
import zlib
from base64 import b64decode, b64encode
from django.db import models
# django-jsonfield
from jsonfield import JSONField
class CompressedJSONField(JSONField):
@fyzd
fyzd / extract_horoscope.py
Created July 14, 2012 19:31 — forked from th0ma5w/extract_horoscope.py
extract context from downloaded html files
"""
Example of using the old BeautifulSoup API to extract content from downloaded html files into CSV... if you're doing this sort of thing today, I recommend using the newer lxml interface directly, but lxml also has a BeautifulSoup compatibility layer.
"""
import os
@liovch
liovch / gist:3168961
Created July 24, 2012 09:01
GIMP color balance filter shader
NSString *const kColorShiftFragmentShaderString = SHADER_STRING
(
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform lowp float redShift;
uniform lowp float greenShift;
uniform lowp float blueShift;
@epoz
epoz / convert.py
Created August 1, 2012 08:29
Converting BNE Bibliography ntriples to BibJSON
import sys
import json
import ntriples
from datetime import datetime
import httplib
ES_URL = "localhost:9200"
ES_PATH = "/bibserver/"
field_mapping = {
@zacharyvoase
zacharyvoase / prob-m2m.md
Created August 22, 2012 01:11
Probabilistic M2M relationships using Bloom filters

Here’s an idea that’s been kicking around inside my head recently.

A standard M2M relationship, as represented in SQL, looks like this:

CREATE TABLE movie (
  id SERIAL PRIMARY KEY,
  name VARCHAR(255)
);
@luispedro
luispedro / readroi.py
Last active December 16, 2020 07:50
Read ImageJ's ROI files
# UPDATE IN 2020
# You almost always will want to use the version at
# https://github.com/luispedro/imread, which is
# up-to-date and works with Python 3
# Copyright: Luis Pedro Coelho <luis@luispedro.org>, 2012
@liuyu81
liuyu81 / c_extension_module.c
Created August 26, 2012 02:54
call Python callback from a non-python thread in a C extension module (in response to zed's demo, https://gist.github.com/3471699, and this question http://stackoverflow.com/questions/12116390/python-code-calls-c-library)
#include "Python.h" // should be before any standard headers
#include <errno.h>
#include <pthread.h>
static void*
non_python_thread(void *python_callback) {
//XXX without PyEval_InitThreads() it produces:
// Fatal Python error: PyEval_SaveThread: NULL tstate
//XXX with PyEval_InitThreads() it deadlocks!!
//XXX without PyGILState_*() (with/without PyEval_InitThreads()) it produces:
@techtonik
techtonik / get_version.py
Last active June 18, 2019 15:41
Python - setup.py - read version without importing (2/3 compatible)
"""
# This snippet is in public domain
# https://gist.github.com/techtonik/4066623/
# Minified (Python 2.6+, 3+ compatible):
import io
from os.path import dirname, join
def get_version(relpath):