Skip to content

Instantly share code, notes, and snippets.

tar -zxvf backup.tar.gz
@mrmartin
mrmartin / download_google_artworks_wikimedia.sh
Created June 12, 2017 11:45
Download wikimedia commons Google Art
#download wikimedia commons Google Art - almost exclusively "flat" art: paintings, drawings, tapestries, ...
mkdir artworks
#two pages contain all top references
wget https://commons.wikimedia.org/wiki/Category:Google_Art_Project_works_by_collection?uselang=en-gb -O top_index.html
wget 'https://commons.wikimedia.org/w/index.php?title=Category:Google_Art_Project_works_by_collection&uselang=en-gb&subcatfrom=Norman+Rockwell+Museum%0AGoogle+Art+Project+works+in+Norman+Rockwell+Museum' -O top_index_2.html
cat top_index_2.html >> top_index.html
rm top_index_2.html
#gallery page urls
@mrmartin
mrmartin / accept-language-human.php
Last active September 18, 2017 11:51
convert any Accept-Language value to human-readable form in php
#associative array of codes and human-readable codes for broswer languages
#including countries for multi-country languages
$langs_accept_language_and_country = array("af"=>"Afrikaans", "hr"=>"Croatian", "el"=>"Greek", "pl"=>"Polish", "sx"=>"Sutu", "sq"=>"Albanian", "cs"=>"Czech", "gu"=>"Gujurati", "pt"=>"Portuguese", "sw"=>"Swahili", "ar"=>"Arabic (Standard)", "da"=>"Danish", "ht"=>"Haitian", "pt_br"=>"Portuguese (Brazil)", "sv"=>"Swedish", "ar_dz"=>"Arabic (Algeria)", "nl"=>"Dutch (Standard)", "he"=>"Hebrew", "pa"=>"Punjabi", "sv_fi"=>"Swedish (Finland)", "ar_bh"=>"Arabic (Bahrain)", "nl_be"=>"Dutch (Belgian)", "hi"=>"Hindi", "pa_in"=>"Punjabi (India)", "sv_sv"=>"Swedish (Sweden)", "ar_eg"=>"Arabic (Egypt)", "en"=>"English", "hu"=>"Hungarian", "pa_pk"=>"Punjabi (Pakistan)", "ta"=>"Tamil", "ar_iq"=>"Arabic (Iraq)", "en_au"=>"English (Australia)", "is"=>"Icelandic", "qu"=>"Quechua", "tt"=>"Tatar", "ar_jo"=>"Arabic (Jordan)", "en_bz"=>"English (Belize)", "id"=>"Indonesian", "rm"=>"Rhaeto-Romanic", "te"=>"Telu
0xFfdeF9e3eD6930A97304797A3bAbE637f5F3CC9E
@mrmartin
mrmartin / read_and_display.m
Created May 6, 2019 12:07
Read, process and display ESA proposal sample data
clear spectral_collage
cd /media/martin/data/ESA_GANGA/TASI-examples/
%read and display
file = fopen('TASI_2018_07_18_124001.cc.dc.rc2bb.sc.rY.sum12.Norb_g.dat.atmY.24-bands.BBT.dat');
im = fread(file,'float');
im = reshape(im,[1754,1713])';
im(im==0)=315;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
ops = '+-*/^'
def calc(nums):
if(nums==[10958]):
print('hooray!')
raise TypeError("found 10958")
for space in range(1,len(nums)):
for op in ops:
if op == '+':
calc(nums[:space-1] + [nums[space-1]+nums[space]] + nums[space+1:])
if op == '-':