Skip to content

Instantly share code, notes, and snippets.

View andreasjansson's full-sized avatar

Andreas Jansson andreasjansson

View GitHub Profile
(require 'cl)
(defun new-shell ()
"Create new shells with consecutive names *shell-1*, *shell-2*, etc.
Remove any stale shells (shells without a live process)"
(interactive)
(let* ((regex "^\\*shell-\\([0-9]+\\)\\*$")
(shell-buffers (loop for buffer in (buffer-list)
if (string-match regex (buffer-name buffer))
collect buffer))
@andreasjansson
andreasjansson / pylint-ignore.el
Last active August 29, 2015 14:05
pylint-ignore
(defun pylint-ignore ()
(interactive)
(save-excursion
(let* ((err (fly-get-err-at-point))
(err-str (flymake-ler-text err))
(err-code (nth 0 (fly-parse-message err-str))))
(end-of-line)
(insert (concat " # pylint: disable=" err-code)))))
(defun fly-parse-message (str)
@andreasjansson
andreasjansson / e3236-linux.md
Last active January 1, 2016 13:09
linux configuration for telenor e3236 mobile broadband

This is how I got it to work on Arch Linux:

First I inserted the Telenor SIM in my mobile phone and removed the PIN code.

Then I followed these instructions to get mbbservice running. Go to https://docs.google.com/open?id=0B4oQlH9i38JPR3hDRlNXbFRWYjQ and click Download. Unzip, and inside the linux_mbb_install directory

chmod +x install
./install

Now you have a file called /usr/local/MobileBrServ/mbbservice. You can either execute that file manually, or put it in some upstart/systemd/whatever script.

@andreasjansson
andreasjansson / expandall.bookmarklet
Created December 20, 2013 11:08
jenkins expand all
javascript:(function() { jQuery('a[title="Show details"]').each(function(i, el) { name = el.id.replace(/-showlink$/, ''); showFailureSummary(name, name.replace(/^test-/, '') + '/summary') }); })()
[[{"connectivity": 0.01, "leakage": 0.02, "spectral_radius": 0.8, "input_scaling": 0.5}, 0.18532477755778726], [{"connectivity": 0.01, "leakage": 0.02, "spectral_radius": 0.9, "input_scaling": 0.5}, 0.14133727725960735], [{"connectivity": 0.01, "leakage": 0.02, "spectral_radius": 1, "input_scaling": 0.5}, 0.19617852627561366], [{"connectivity": 0.01, "leakage": 0.02, "spectral_radius": 1.1, "input_scaling": 0.5}, 0.16502468929653397], [{"connectivity": 0.01, "leakage": 0.02, "spectral_radius": 1.2, "input_scaling": 0.5}, 0.24071467760788148], [{"connectivity": 0.01, "leakage": 0.02, "spectral_radius": 1.3, "input_scaling": 0.5}, 0.11018344028052766], [{"connectivity": 0.01, "leakage": 0.05, "spectral_radius": 0.8, "input_scaling": 0.5}, 0.13076978125521815], [{"connectivity": 0.01, "leakage": 0.05, "spectral_radius": 0.9, "input_scaling": 0.5}, 0.77801102072946737], [{"connectivity": 0.01, "leakage": 0.05, "spectral_radius": 1, "input_scaling": 0.5}, 0.78662245652536911], [{"connectivity": 0.01, "leakage": 0.
[[{"connectivity": 0.01, "leakage": 0.1, "spectral_radius": 0.1, "input_scaling": 0.1}, 0.54114612310960497], [{"connectivity": 0.01, "leakage": 0.1, "spectral_radius": 0.4, "input_scaling": 0.1}, 0.57285923827828633], [{"connectivity": 0.01, "leakage": 0.1, "spectral_radius": 0.7, "input_scaling": 0.1}, 0.6181022710029842], [{"connectivity": 0.01, "leakage": 0.1, "spectral_radius": 1, "input_scaling": 0.1}, 0.70535127206514592], [{"connectivity": 0.01, "leakage": 0.1, "spectral_radius": 1.2, "input_scaling": 0.1}, 0.72669566536846897], [{"connectivity": 0.01, "leakage": 0.4, "spectral_radius": 0.1, "input_scaling": 0.1}, 0.55705325982499621], [{"connectivity": 0.01, "leakage": 0.4, "spectral_radius": 0.4, "input_scaling": 0.1}, 0.60631733346821104], [{"connectivity": 0.01, "leakage": 0.4, "spectral_radius": 0.7, "input_scaling": 0.1}, 0.67335997167568662], [{"connectivity": 0.01, "leakage": 0.4, "spectral_radius": 1, "input_scaling": 0.1}, 0.75767538313691773], [{"connectivity": 0.01, "leakage": 0.4, "spectr
@andreasjansson
andreasjansson / gist:5601220
Last active December 17, 2015 11:19
python logging colours
alias colorlog='ack --flush --passthru --color --color-match=blue "DEBUG:" |
ack --flush --passthru --color --color-match=green "INFO:" |
ack --flush --passthru --color --color-match=yellow "WARNING:" |
ack --flush --passthru --color --color-match=red "ERROR:" |
ack --flush --passthru --color --color-match=magenta "CRITICAL:"'
@andreasjansson
andreasjansson / .conkyrc
Last active December 15, 2015 13:59
macbook .conkyrc
out_to_console yes
out_to_x no
background no
update_interval 2
total_run_times 0
use_spacer left
short_units
no_buffers yes
TEXT
index.number_of_shards: 1
index.number_of_replicas: 0
gateway.expected_nodes: 1
[2013-03-26 14:01:55,079][INFO ][node ] [Inza] {0.90.0.RC1}[21712]: initializing ...
[2013-03-26 14:01:55,079][DEBUG][node ] [Inza] using home [/opt/elasticsearch-0.90.0.RC1], config [/opt/elasticsearch-0.90.0.RC1/config], data [[/data]], logs [/opt/elasticsearch-0.90.0.RC1/logs], work [/opt/elasticsearch-0.90.0.RC1/work], plugins [/opt/elasticsearch-0.90.0.RC1/plugins]
[2013-03-26 14:01:55,085][INFO ][plugins ] [Inza] loaded [], sites []
[2013-03-26 14:01:55,096][DEBUG][common.compress.lzf ] using [UnsafeChunkDecoder] decoder
[2013-03-26 14:01:55,107][DEBUG][env ] [Inza] using node location [[/data/elasticsearch/nodes/0]], local_node_id [0]
[2013-03-26 14:01:56,612][DEBUG][threadpool ] [Inza] creating thread_pool [generic], type [cached], keep_alive [30s]
[2013-03-26 14:01:56,619][DEBUG][threadpool ] [Inza] creating thread_pool [index], type [cached], keep_alive [5m]
[2013-03-26 14:01:56,619][DEBUG]