I hereby claim:
- I am eliask on github.
- I am eliask (https://keybase.io/eliask) on keybase.
- I have a public key ASDtKagWNb0t4v2MDGYurC6MNHwumDQg3zem-JSZHazG_wo
To claim this, I am signing this object:
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # https://gist.github.com/292018 - augmented to plot row/column labels | |
| """ | |
| Draws Hinton diagrams using matplotlib ( http://matplotlib.sf.net/ ). | |
| Hinton diagrams are a handy way of visualizing weight matrices, using | |
| colour to denote sign and area to denote magnitude. | |
| By David Warde-Farley -- user AT cs dot toronto dot edu (user = dwf) | |
| with thanks to Geoffrey Hinton for providing the MATLAB code off of |
| #! /usr/bin/env python | |
| # -*- encoding: utf-8 -*- | |
| # Usage: double_utf8_fix.py < input > output | |
| import sys, re | |
| # functions to detect/fix double-encoded UTF-8 strings | |
| # Based on http://blogs.perl.org/users/chansen/2010/10/coping-with-double-encoded-utf-8.html | |
| DOUBLE_ENCODED = re.compile(""" | |
| \xC3 (?: [\x82-\x9F] \xC2 [\x80-\xBF] # U+0080 - U+07FF | |
| | \xA0 \xC2 [\xA0-\xBF] \xC2 [\x80-\xBF] # U+0800 - U+0FFF |
| #!/usr/bin/env python3 | |
| import re | |
| from itertools import * | |
| A=''' | |
| Cod | |
| Ár (Year) Lína (Long line) Dragnót (Demersal seine) Botnvarpa (Demersal trawl) Net (Gill net) Öll veiðarfæri (All gear) | |
| Fjöldi (Numbers) Þyngd (Weight) Fjöldi (Numbers) Þyngd (Weight) Fjöldi (Numbers) Þyngd (Weight) Fjöldi (Numbers) Þyngd (Weight) Fjöldi (Numbers) Þyngd (Weight) | |
| Brottkast % brottk. Brottkast % brottk. Skekkja Brottkast % brottk. Brottkast % brottk. Skekkja Brottkast % brottk. Brottkast % brottk. Skekkja Brottkast % brottk. Brottkast % brottk. Skekkja Brottkast % brottk. Brottkast % brottk. | |
| (Discards) (% disc.) (Discards) (% disc.) (C.V) (Discards) (% disc.) (Discards) (% disc.) (C.V) (Discards) (% disc.) (Discards) (% disc.) (C.V) (Discards) (% disc.) (Discards) Tonn (% disc.) (C.V) (Discards) (% disc.) (Discards) (% disc.) | |
| n Tonn n Tonn n Tonn n n Tonn |
| #! /usr/bin/env python3 | |
| # Usage: mbox_stuff.py All\ mail\ Including\ Spam\ and\ Trash.mbox | |
| import mailbox | |
| import traceback | |
| import sys | |
| from itertools import chain | |
| num = 1 | |
| def get_parts(msg,n=0): | |
| global num |
| #!/usr/bin/env python3 | |
| # | |
| # Hacky but functional script for extracting data from (Finnish) Nordea web bank account statement PDF files. | |
| # | |
| # 1. Presumes you have some account statements to clean up (for hledger, for instance). | |
| # 2. The normal {Transactions,Tapahtumat}_<IBAN>.txt CSV files are by far superior to work with, | |
| # but they are no longer available after just a year or two (better archive them while you can!). | |
| # 3. I wanted to have more history available, so I devised this hacky method to extract it | |
| # sort of cleanly from the PDF account statements in Finnish. | |
| # |
| #!/usr/bin/env python | |
| # ppxml - pretty print XML from stdin or argv files | |
| # | |
| # NB: if multiple XML files are specifies, concatenates the prettyprinted | |
| # versions one after the other. | |
| # | |
| # Python 2 and Python 3 compatible AFAICT. | |
| # | |
| import sys | |
| import xml.dom.minidom as md |
| function c() { | |
| url='https://www.google.com/complete/search?client=hp&hl=en&xhr=t' | |
| # NB: user-agent must be specified to get back UTF-8 data! | |
| curl -H 'user-agent: Mozilla/5.0' -sSG --data-urlencode "q=$*" "$url" | | |
| jq -r .[1][][0] | | |
| sed 's,</\?b>,,g' | |
| } |
| #!/usr/bin/env bash | |
| har=www.instagram.com.har | |
| time jq -r .log.entries[].request.url "$har" | | |
| grep scontent | | |
| sed 's#[ps][0-9]*x[0-9]*/sh0\.08/##;s#[sp][0-9]*x[0-9]*/##' | | |
| sort -u | | |
| xargs wget --timestamping --trust-server-names |
I hereby claim:
To claim this, I am signing this object:
| #NB. Generated with https://github.com/eliask/curlconverter using "Copy as cURL" | |
| import requests | |
| cookies = { | |
| 'gsScrollPos': '', | |
| 'NOMADOR_SESSION': '', | |
| } | |
| headers = { | |
| 'Accept-Encoding': 'gzip, deflate, sdch, br', |