Skip to content

Instantly share code, notes, and snippets.

@krischer
krischer / cOpenGL.pyx
Created December 5, 2012 21:47
Cython definition file for OpenGL (first line might need to be modified for some platforms)
cdef extern from "OpenGL/gl.h" nogil:
enum: __gl_h_
enum: GL_TYPEDEFS_2_0
enum: GL_LOGIC_OP
enum: GL_TEXTURE_COMPONENTS
enum: GL_VERSION_1_1
enum: GL_VERSION_1_2
enum: GL_VERSION_1_3
enum: GL_VERSION_1_4
enum: GL_VERSION_1_5
@krischer
krischer / cSDL.pyx
Created December 5, 2012 21:49
Cython definition file for SDL 2.x
cdef extern from "i386/types.h" nogil:
ctypedef signed char int8_t
ctypedef short int16_t
ctypedef int int32_t
ctypedef long long int64_t
cdef extern from "iconv.h" nogil:
ctypedef void *iconv_t
cdef extern from "stdlib.h" nogil:
@krischer
krischer / clibmseed.pyx
Created December 5, 2012 21:51
Cython header file for libmseed
cdef extern from "i386/types.h" nogil:
ctypedef long long int64_t
ctypedef signed char int8_t
ctypedef short int16_t
ctypedef int int32_t
cdef extern from "stdint.h" nogil:
ctypedef unsigned short uint16_t
ctypedef unsigned char uint8_t
ctypedef unsigned int uint32_t
@krischer
krischer / iris2quakeml.py
Last active December 11, 2015 20:39
Small script downloading Global CMT events from the IRIS Spud service. It makes sure the downloaded events are valid QuakeML files. Furthermore the moment tensor components are converted from dyn*cm to N*m. Also only one origin, one magnitude and one focal mechanism will remain in the file.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Download and fix the QuakeML files provided by the IRIS SPUD momenttensor
service
http://www.iris.edu/spud/momenttensor
Downloads the files and saves them as a QuakeML file. You can either
refer to the site displaying the event or the quakeml url.
@krischer
krischer / namelist.py
Last active December 13, 2015 16:58
Token based Fortran namelist parser. Let me know if anything does not work.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Fortran namelist parser. Converts nameslists to python dictionaries.
Should be fairly robust. Cannot be used for verifying fortran namelists as it
is rather forgiving.
Error messages during parsing are kind of messy right now.
@krischer
krischer / pandas.ipynb
Created March 25, 2013 11:26
Simple log analysis with Pandas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@krischer
krischer / index.html
Created April 20, 2013 20:03
Simple Rotating Globe
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script>
// The size of the map.
var width = 960;
var height = 500;
@krischer
krischer / filter_design.pynb
Last active December 16, 2015 21:39
filter_design.pynb
{
"metadata": {
"name": "Decimation Filter Design"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@krischer
krischer / anna.ipynb
Last active May 4, 2023 08:42
anna.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@krischer
krischer / gist:5699506
Created June 3, 2013 16:47
Quest Observatory
{
"metadata": {
"name": "Quest Quake"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{