Skip to content

Instantly share code, notes, and snippets.

@kidpixo
kidpixo / glue_manipulation.py
Created Feb 25, 2014
glue manipulation code
View glue_manipulation.py
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'
View gist:9526076

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 Mar 13, 2014
Glueviz Image Manipulation
View glued_figure_manipulation.py
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'
View mariolibrary.py
# -*- coding: utf-8 -*-
"""
My personal python library.
@author: damo_ma
"""
import numpy as np
@kidpixo
kidpixo / classification_to_shapefile.py
Created May 15, 2014
First draft of a classification_to_shapefile routine
View classification_to_shapefile.py
####################################################################################################################################
##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 Jun 25, 2014
conversion script fro dump
View bash.sh
# !/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 Aug 29, 2015
jump for fish: marks function
View mark.fish
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 Aug 29, 2015
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…
View idllang.vim
"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 Aug 29, 2015
tmux session description to use with tmuxinator example.
View tmuxinator.yaml
#!/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