Skip to content

Instantly share code, notes, and snippets.

@feth
feth / letsgetdirty.py
Created March 26, 2012 05:47
print invocation context
from inspect import currentframe, isfunction, ismethod, isclass, getframeinfo
def wannaknow(message):
#wander until correct frame
frame = currentframe()
interframe = frame.f_back
frame = interframe.f_back
if frame is None:
@feth
feth / source_tcsh.sh
Last active December 24, 2015 16:08
source tcsh environment variables
# bash script to be sourced
source_tcsh() {
tchsh_file=$1
TCSH_ENV=`tcsh -c "source ${tchsh_file} ; printenv"`
NEW_ENV=`echo -e "$TCSH_ENV" | sed -e 's/=/=\"/' -e 's/$/\"/' -e '/^PROFILEREAD=.*$/d'`
eval "$NEW_ENV"
}
@feth
feth / myfirstinadequate3dbar.py
Created November 20, 2013 09:16
Oksélé. My first inadequate 3d bar plot with matplotlib
# encoding: utf-8
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import numpy as np
import codecs
import pylab
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
@feth
feth / log.py
Created June 19, 2015 00:01
python logging wrapper
"""
logging tools
logging is mainly configured in app.ini
Here lie only a few wrappers/tools, including those used by the app.ini config
"""
import inspect
import logging
@feth
feth / log.py
Created October 14, 2015 05:27
wrapper for Python logging - limited but so easy!
"""
logging tools
logging is mainly configured in app.ini
Here lie only a few wrappers/tools, including those used by the app.ini config
"""
import inspect
import logging

Keybase proof

I hereby claim:

  • I am feth on github.
  • I am feth (https://keybase.io/feth) on keybase.
  • I have a public key whose fingerprint is 0969 CD89 B991 5E83 3459 4626 8CA5 6E09 A903 0823

To claim this, I am signing this object:

from __future__ import division
import collections
import logging
import linecache
import re
import sys
log = logging.getLogger(__name__)
from pyramid.exceptions import HTTPBadRequest
from cornice.resource import Service
from biologie.views.forms import ROOTNODE
from biologie.views.forms import AppNode
activite_generale = AppNode(
name='Activité générale',
path='activite_generale/',
@feth
feth / Py3.py
Last active July 22, 2016 09:33
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import serial
import struct
import http.client
import urllib.request, urllib.parse, urllib.error
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import datetime
import sys
import serial, time, struct
import http.client, urllib.request, urllib.parse, urllib.error
ser = serial.Serial("/dev/ttyUSB0", baudrate=9600, stopbits=1, parity="N", timeout=2)