Skip to content

Instantly share code, notes, and snippets.

@kidpixo
kidpixo / isis3Startup.sh
Last active December 17, 2015 14:49
[ISIS3](1) Startup file for the [fish shell](2), a command line shell for the 90s. Remember to use " set -xg $ISISROOT" in your configuration file to set is as global! [1] : http://fishshell.com/ [2] : http://isis.astrogeology.usgs.gov/
#!/opt/local/bin/fish
################################################################################
# This file should be sourced within your current shell using the ". "
# command. Since this is only a beta version we do not suggest you add this
# command to your startup file
#
# On the command line type:
# > setenv ISISROOT ????
# > cd $ISISROOT
# > . isis3Startup.csh
Missing from the descriptio on http://www.ni.com/white-paper/5696/en : TDMS File Format Internal Structure
The string fields have N_VALUES*32 bits / 4 bytes filed before the data pointing to each string value, starting at the end of the address field
## Example
file : XXXXX.tdms
Start : 6221213 / 5EED9D
Channel: /'TM_SCIENCE_TIS_DATA'/'par_tis_bin_mode_txt:2'
RAW_DATA_DESCRIPTOR :
@kidpixo
kidpixo / new_gist_file.sql
Created October 24, 2013 09:08
amazza che mazzasql
WITH p AS (
SELECT *
FROM (SELECT array_agg(id_meas) AS arr_id_meas,id_poly FROM user_polygons_vertex_intersection GROUP BY id_poly ORDER BY COUNT(id_meas) ASC LIMIT 2 OFFSET 500) up_in
INNER JOIN user_polygons up ON up_in.id_poly=up.polygon_id
WHERE view_short_name='global_grid_1dpp'
)
SELECT COUNT(m.id_meas),p.id_poly,trim(first(p.polygon_name)) AS polygon_name,ST_AsText(first(p.polygon))
FROM vir_point_data m,p
WHERE m.id_meas = ANY (p.arr_id_meas)
GROUP BY p.id_poly;
@kidpixo
kidpixo / my_xkdc_plot.py
Created October 24, 2013 12:03
my_xkdc_plot
import matplotlib.pyplot as plt
import numpy as np
x = np.array([2.,200.,2000.,20000.,200000.,2000000.,20000000.,24973866.])
y = np.array([11213.989,11419.187,13149.363,73087.506,231421.730,208442.174,211770.931,207008.041])
plt.xkcd() # Yes...
plt.plot(np.log(x)/np.log(10), y/(1000*60), 'r', np.log(x)/np.log(10), y/(1000*60), 'ro')
# plt.plot(x, y/(1000*60), 'r', x, y/(1000*60), 'bo')
@kidpixo
kidpixo / nvalt log
Created November 13, 2013 10:36
nvALT 111 Simplenote sync is stuck, I deleted all the note in Simplenote and try to add all my local note back on the website, no luck. The webapp Simplenote stay empty, nvalt is not sending any note! See issue report > https://github.com/ttscoff/nv/issues/212
$ /A/n/C/MacOS> ./nvALT
2013-11-13 11:25:11.139 nvALT[48732:707] load time: 0.059869,
2013-11-13 11:25:11.143 nvALT[48732:707] finished: '/var/folders/zz/mbz2k61d1d14rb4p3zckh5680000gp/T/NVPlainTextEditingSpace'
2013-11-13 11:25:22.574 nvALT[48732:707] local: 0 added, 137 changed, 28 deleted, 0 to merge
2013-11-13 11:25:22.574 nvALT[48732:707] remote: 150 added, 15 changed, 0 deleted, 0 missing
2013-11-13 11:25:36.262 nvALT[48732:707] removing 15 notes
2013-11-13 11:25:40.535 nvALT[48732:707] Updating tags with remote values.
2013-11-13 11:25:41.065 nvALT[48732:707] Updating tags with remote values.
2013-11-13 11:25:53.736 nvALT[48732:707] *** setObjectForKey: object cannot be nil (key: systemtags)
@kidpixo
kidpixo / new_gist_file.css
Created November 17, 2013 11:54
Chrome New Tab
#main a { font-family: "Sans-serif"; }
#main a { font-size: 1.6em; }
#main a { color: #555555; }
body { background-color: #ffffff; }
#main a:hover { background-color: #e4f4ff; }
#main a:hover { color: #000000; }
#main a:hover { box-shadow: 0 0 7px #57b0ff; }
body { background-image: url(); }
body { background-image: url(); }
body { background-position: left top; }
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# envi cube/header name
file=494253260BrDnTR
raw2isis from=$file.dat to=$file.cub \
samples=`sed -En '/sample/s/.*=[[:space:]]+(.*)/\1/p' $file.hdr` \
lines=`sed -En '/lines/s/.*=[[:space:]]+(.*)/\1/p' $file.hdr` \
bands=`sed -En '/bands/s/.*=[[:space:]]+(.*)/\1/p' $file.hdr` \
bittype=real
# get bittype from IDL type list http://www.exelisvis.com/docs/IDL_Data_Types.html
@kidpixo
kidpixo / download_lpsc_livestream.sh
Last active April 5, 2016 09:13
Ddownload the lpsc2016 livestream videos, because youtube-dl has some bug with livestream.com. It extract each video url and name and saves it.
#1.1 this implies you have curl, sed , grep and jq on your system, if not skip to section #2.1
curl http://livestream.com/viewnow/LPSC2016 | grep ".smil" | sed -e 's#<script type="text/javascript">window.config =##' -e 's#;</script>##' | jq -M . > view-source_livestream.com_viewnow_LPSC2016.json
#1.2 this filter the json data embedded in the html page
jq ".event.feed.data[] | { caption : .data.caption , progressive_url_hd : .data.progressive_url_hd}" view-source_livestream.com_viewnow_LPSC2016.json
#2.1 A wise use of vim & regex produces >
curl -o "Press Briefing: Tales of a Tilting Moon Hidden in Lunar Ice.mp4" "http://pdvod.new.livestream.com/events/00000000004c5105/2aaed534-8d90-41b0-94e9-6a898d710a8a_2000.mp4?__gda__=1459861194_7b3cae019a2f51c7abc70ddeded804ba"
curl -o "The Exploration of Pluto.mp4" "http://pdvod.new.livestream.com/events/00000000004c5105/15d4b2b5-c873-4f8f-baf0-bf442c450b19_2320.mp4?start=75&end=5078&__gda__=1459861194_eab4c7c7f9ffb86b211c9d7483539194"
curl -o "Press Briefing: Ceres: D
@kidpixo
kidpixo / cyclic_range.py
Created April 25, 2016 09:20
Create a class to do arithmetic (now only addition/subtraction) on a cyclic domain, like the 0-360 degrees interval on a circumference.
# Define cyclic_range methods
class cyclic_range:
def __init__(self, xmin, xmax):
self.xmin = xmin
self.xmax = xmax
self.size = xmax-xmin
self.description = "Class cyclic_range describe a generic cyclic closed interval, like 0-360 degrees"
self.author = "kidpixo@gmail.com"