Skip to content

Instantly share code, notes, and snippets.

@kidpixo
kidpixo / glue_manipulation.py
Created February 25, 2014 14:43
glue manipulation code
import glue
clients_classes = (glue.clients.HistogramClient,glue.clients.ImageClient,glue.clients.ScatterClient)
clients = []
for i in range(size(hub._subscriptions.keys())):
tmp = hub._subscriptions.keys()[i]
if isinstance(tmp, glue.clients.HistogramClient):
is_class = 'histogram'

This is all based on the [alpha release][1].

Properties

From the built-in help system:

For many settings TextMate will look for a .tm_properties file in the current folder and in any parent folders (up to the user’s home folder).

These are simple setting = value listings where the value is a format string in which other variables can be referenced.

@kidpixo
kidpixo / glued_figure_manipulation.py
Created March 13, 2014 11:09
Glueviz Image Manipulation
import glue
clients_classes = (glue.clients.HistogramClient,glue.clients.ImageClient,glue.clients.ScatterClient)
clients = []
for i in range(size(hub._subscriptions.keys())):
tmp = hub._subscriptions.keys()[i]
if isinstance(tmp, glue.clients.HistogramClient):
is_class = 'histogram'
@kidpixo
kidpixo / mariolibrary.py
Created April 4, 2014 09:17
mariolibrary
# -*- coding: utf-8 -*-
"""
My personal python library.
@author: damo_ma
"""
import numpy as np
@kidpixo
kidpixo / classification_to_shapefile.py
Created May 15, 2014 15:23
First draft of a classification_to_shapefile routine
####################################################################################################################################
##Test
import matplotlib
# matplotlib.use('Agg') # non interactive
# %matplotlib qt
# from matplotlib import pyplot as plt
import numpy as np
plot_matrix = np.array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@kidpixo
kidpixo / bash.sh
Created June 25, 2014 14:32
conversion script fro dump
# !/bin/bash
#
# 1. It assumes th data are in the Demo_Mapping_Data_Dump.txt file
# 2. It creates:
# - Orbits.txt : contains the orbits numbers and line numbers
# - Demo_Mapping_Data_Dump.csv : Demo_Mapping_Data_Dump.txt converted to csv with custom header
# - Demo_Mapping_Data_Dump_polygon.csv : added an WKT polygon to Demo_Mapping_Data_Dump.csv
#
# Orbit file: all lines with containing "Orbit: "
# Line Orbit
@kidpixo
kidpixo / mark.fish
Last active August 29, 2015 14:05
jump for fish: marks function
function marks
if test (count $argv) -gt 0
echo "Usage: marks"
else
set -l file_list (command ls $MARKPATH)
if test (count $file_list) -eq 0
echo "No marks currently defined."
else
set -l mark_list
for file in $file_list
@kidpixo
kidpixo / idllang.vim
Last active August 29, 2015 14:07
This is my IDL (from exelis http://www.exelisvis.com/ProductsServices/IDL.aspx). Put it in ~/.vim/ftplugin/idllang.vim and it will be loaded for idlang (*.pro) files. It implement send visually selected text from one panel to the other (names are hardcoded, it is on the todo list). This is my workaround to use a code interpreter having state mem…
"mostly cosmetic make-up
set foldnestmax=1
set foldmethod=indent
set foldlevel=99
function! YankToTmuxPane()
" silently put the selected text in the tmux buffer 0
silent '<,'>w !tmux load-buffer -b 0 -
" put the tmux buffer 0 in the session_name:window_name.0
" assuming we are in the window 1, see pic http://bit.ly/1stWOe2
@kidpixo
kidpixo / tmuxinator.yaml
Last active August 29, 2015 14:10
tmux session description to use with tmuxinator example.
#!/opt/local/bin/python
# see : https://developers.google.com/gmail/api/quickstart/quickstart-python
# google API doc : https://developers.google.com/gmail/api/v1/reference/users/messages#resource
import httplib2
import sys
from apiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run