Skip to content

Instantly share code, notes, and snippets.

View astrojuanlu's full-sized avatar

Juan Luis Cano Rodríguez astrojuanlu

View GitHub Profile
@octplane
octplane / mongo_pubsub.rb
Created November 9, 2010 16:17
Simple Pub/Sub system using MongoDB, capped collections and tailable cursors in ruby
require 'rubygems'
require 'mongo'
module MongoPubSub
QUEUES_COLLECTION = 'queues'
class EndSubscriptionException < Exception; end
class Publisher
def initialize(queue_name, mongo_connection)
# Initialize queue collection as a capped collection
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name)
@brantfaircloth
brantfaircloth / sphinx_to_github.sh
Created January 23, 2011 02:40
Sphinx documentation to github gh-pages without submodules
# assume the following directory structure where contents of doc/
# and source/ are already checked into repo., with the exception
# of the _build directory (i,e. you can check in _themes or _sources
# or whatever else).
#
# proj/
# source/
# doc/
# remove doc/_build/html if present
@dupuy
dupuy / README.rst
Last active May 5, 2024 18:42
Common markup for Markdown and reStructuredText

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@sgillies
sgillies / geo_interface.rst
Last active April 10, 2024 00:26
A Python Protocol for Geospatial Data

Author: Sean Gillies Version: 1.0

Abstract

This document describes a GeoJSON-like protocol for geo-spatial (GIS) vector data.

Introduction

@javisantana
javisantana / fall.js
Created October 15, 2012 09:51
redbull stratos fall simulation
// redbull stratos fall simulation
// node fall.js > fall.json
//
// port to js from python by @pybonacci
// more info: http://pybonacci.wordpress.com/2012/10/15/el-salto-de-felix-baumgartner-en-python/
//
// >> [ std_atm.alt2density(h, alt_units='m', density_units='kg/m**3') for h in xrange(0, 43000, 1000)]
// air density each 1000 meters
var AIR_DENSITY = [1.225, 1.1116425767380347, 1.0064902527218418, 0.9091220810460088, 0.8191294202172186, 0.7361158590983954, 0.6596971404886504, 0.5895010832794331, 0.5251675031230921, 0.4663481315454516, 0.41270653342889785, 0.3639180227868754, 0.3108281589022067, 0.2654832635841079, 0.22675346883692057, 0.19367373647373748, 0.16541981206327336, 0.14128768681425868, 0.1206760556449457, 0.10307133434187116, 0.08803486247736621, 0.07487366111494297, 0.06372734460638993, 0.05428027105802167, 0.046267360336640966, 0.039465817649795336, 0.03368824062938579, 0.02877687388504317, 0.024598816068418232, 0.021042018277291016, 0.018011940446444, 0.01542875529531276, 0.0132250083
@kikocorreoso
kikocorreoso / ipynp2wp.py
Created December 1, 2012 23:58
Publish an ipynb directly in wordpress.com (proof of concept)
# -*- coding: utf-8 -*-
## Basado en el script originalmente publicado en
## http://www.jansipke.nl/using-python-to-add-new-posts-in-wordpress/
import datetime
import xmlrpclib
from xml.sax.saxutils import escape
import json
import markdown
@chemacortes
chemacortes / gist:5713746
Created June 5, 2013 13:13
Forget about #Unicode problems on ANY Version of #Python !
# put this after the imports on your .py files
try: # py2
str, range, input = unicode, xrange, raw_input # lint:ok
except NameError: # py3
buffer, long = memoryview, int # lint:ok
@josef-pkt
josef-pkt / scipy_parse_special_fortran_0.py
Last active December 22, 2015 05:49
parsing Fortran docstrings
# -*- coding: utf-8 -*-
"""Parsing the Fortran files to create raw docstrings
Created on Tue Sep 03 10:11:10 2013
Author: Josef Perktold
open problems
cumnor.f doesn't define segment headers besides "Function"
@danieljfarrell
danieljfarrell / odesolver.py
Last active December 22, 2015 13:59
Fleshing out a ode solver interface for scipy.
# Instantiation.
# Make a solver object, created automatically with default options. The solve is instantiated
# only with the variables that are common to all of the solvers. This means 1) the r.h.s. of
# function to solve, 2) a start time, 3) initial conditions, 4) Jacobian function. Strictly
# speaking the Jacobian is optional here because only some solvers will require it. As a
# compromise lets pass it as a keyword argument, this also gets around any awkward 'use_jac'
# options because the solver either has a Jacobian function at init time or it does not.
solver = odesolver("cvodes", ode_function, time_start, initial_conditions, jacobian_function=None)
# Solver options.
@jonathansp
jonathansp / sptrans.py
Created November 15, 2013 20:50
Um cliente python para a API Olho Vivo da SPTrans de São Paulo
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
""" Um cliente python para a API Olho Vivo """
import requests
class SPTransClient(object):
""" Um cliente python para a API Olho Vivo """