Skip to content

Instantly share code, notes, and snippets.

💭
workon on https://github.com/omegaml

miraculixx

💭
workon on https://github.com/omegaml
  • Switzerland
Block or report user

Report or block miraculixx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miraculixx
miraculixx / getlicense.py
Created Jun 29, 2017
getlicense -- collect license information in your project
View getlicense.py
def getlicenses(dir=None):
"""
simple licence collector
"""
import re
dir = dir or '.'
LICENSE_FILES = r'LICENSE.*'
SOURCE_FILES = r'(.*css$)|(.*js$)|(.*min$)|(.*json$)'
LICENSE_IDS = r'.*(MIT|BSD|GPL|GNU.GPL|LPGL|APACHE).*'
SOURCE_LINKS = r'.*(http.*://\W*\s)'
@miraculixx
miraculixx / README.md
Created Sep 5, 2016
start ipython notebook including django
View README.md
import os
if os.environ.get('DJANGO_SETTINGS_MODULE'):
  print "Initializing Django..."
  if not os.path.exists('app/settings.py'):
      os.chdir('..')
  print "(in directory %s)" % os.getcwd()
  try:
    from django_extensions import management
  except BaseException as e:
@miraculixx
miraculixx / README.md
Last active Aug 8, 2016
A simple, extendible python file parser with high processing speed and low memory overhead
View README.md

in response to [this question on stackoverflow]

Installation:

$ chmod +x csvparse.py

Usage:

@miraculixx
miraculixx / README.md
Created May 11, 2016
quickly get geojson objects
View README.md
pip install requests
pip install geojson

example output

$ python getsamplecoords.py
[('New York', (-74.0059413, 40.7127837)), ('Geneva', (6.1431577, 46.2043907)), ('Bern', (7.4474468, 46.9479739)), ('Zurich', (8.541694, 47.3768866))]
@miraculixx
miraculixx / mongodb.py
Created Apr 6, 2016
straight forward django database adapter for mongoengine
View mongodb.py
# mongoengine's database instance
import urlparse
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
# cached mongodb instances, by alias
_mongodb = {}
@miraculixx
miraculixx / how-it-works.md
Last active Feb 19, 2016
Schematic link between Python, C, Theano, CUDA, Windows 7, Machine Code, CPU, GPU and many more?
View how-it-works.md

answer to Schematic link between Python, C, Theano, CUDA, Windows 7, Machine Code, CPU, GPU and many more?

There is a [very good paper][1] published by James Bergstra et al, Proceedings of the 9th PYTHON IN SCIENCE CONF. (SCIPY 2010) describing the idea of Theano and how it works behind the scenes.

In fact, it's abstract is already quite informative. Let's go through it step by step:

Abstract — Theano is a compiler for mathematical expressions in Python that combines the convenience of NumPy’s syntax with the speed of optimized native machine language.

@miraculixx
miraculixx / 0_reuse_code.js
Created Feb 19, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@miraculixx
miraculixx / oldnewupdate.ipynb
Last active Feb 12, 2016
merge old and new dataframe based on Date, update missing values in new with values from old
View oldnewupdate.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@miraculixx
miraculixx / benchmark.ipynb
Last active Jan 29, 2016
benchmarking groupwise apply and transform to set flag based on group aggregation
View benchmark.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View README.md

data as per the cubes tutorial at http://cubes.readthedocs.org/en/v1.0.1/tutorial.html the data has been converted to valid json suitable for loading with mongodb

# convert datetime value for year
import pandas as pd
import datetime
df = pd.read_csv('ibrd_balance.csv')
df.year = df.year.apply(lambda y : datetime.datetime(y,1,1))
You can’t perform that action at this time.