Skip to content

Instantly share code, notes, and snippets.

Jonas Berlin xkr47

View GitHub Profile
@xkr47
xkr47 / Cargo.toml
Last active Jun 19, 2020
Seriously funny rust error message
View Cargo.toml
[package]
name = "x"
version = "0.1.0"
edition = "2018"
[dependencies]
dbus = "0.8.1"
@xkr47
xkr47 / README.md
Last active Nov 11, 2019
Simple calculator in https://raku.org/ language, with support for time durations & base 2..36
View README.md

Example session:

2+3

Result: 5₁₀

5d

Result: 5,00:00:00 = 5.000000 days
         120:00:00 = 120.000000 hours
@xkr47
xkr47 / doodle.css
Last active Sep 24, 2019
Fix Doodle to use full screen width and to stop resetting the horizontal scrolling when scrolling "outside" the vote table
View doodle.css
.d-pagesContainer {
max-width: unset !important;
}
.d-expandableScrollContainer {
overflow: visible !important;
background: white;
max-width: unset !important;
width: unset !important;
}
#d-participationPage #d-metadataView .d-pollMetadataRow, #d-participationPage #d-metadataView .d-pollHiddenButton.d-silentButton {
View flowdock.css
/* make notifications darker - suitable for dark theme */
.msg-body {
color: #585860;
}
.comment-group-hover .msg-body {
color: #9090a0;
}
/* just restore default theme colour that gets overridden by the above for normal messages */
.msg-body > p, .msg-body ul {
@xkr47
xkr47 / message.js
Last active Aug 23, 2019
keybase ephemeral message test
View message.js
// rendition of a message "test" set to expire in 30 seconds, as retrieved by json api after "exploding":
// $ keybase chat api -p -m '{"method": "read", "params": {"options": {"channel": {"name": "keybasefriends", "members_type": "team", "topic_name": "general", "pagination": {"num": 1}}}}}'
{
"msg": {
"id": 52853,
"conversation_id": "0000d5ba71470610a40b4d32af53a52775cc561589525d7b21bad9ec057b6aac",
"channel": {
"name": "keybasefriends",
"public": false,
"members_type": "team",
@xkr47
xkr47 / focusrite-scarlett-linux.md
Last active Jul 20, 2020
Focusrite Scarlett Linux support 2019-07-29
View focusrite-scarlett-linux.md

Focusrite Scarlett Linux support 2019-07-29

1st gen <2012

  • Solo
  • Studio
  • 2i2
  • 2i4
  • 6i6 1235:8012 since Linux 3.19
@xkr47
xkr47 / jsonmap
Last active Oct 26, 2018
My perl-based `jq` replacement
View jsonmap
echo -n '{"a":5,"b":7}' | jsonmap -r '$_->{"a"}." and ".$_->{"b"}'
#!/usr/bin/perl
# usage: $0 [options] <perlcode> [<inputfile>]
#
# reads json from stdin/inputfile, or if -R given, reads whole input as a string
# perlcode gets the json/string as a perl object in $_
# return object from perlcode is encoded as json to stdout, or passed as-is if -r given
# pretty-printed by default, -c for compact
# all input/output is in UTF-8
@xkr47
xkr47 / README.md
Last active Sep 11, 2018
Handy script for generating a github "diff" url between two refs
View README.md

Example:

$ github-diff origin/master 04ed4b
https://github.com/example/repo/compare/a418bcece3d540ad1d4864030635c2d4ae2628b3...04ed4b34bee0a2b2003f3744b772473a4c8b604b

Requires the commits to be available locally, so you might have to git fetch first.

@xkr47
xkr47 / ot-poi.txt
Last active Jun 9, 2019
Handy queries for Overpass Turbo - https://overpass-turbo.eu
View ot-poi.txt
// Handy search for POI objects - just swap `shop=kiosk` out for any `key=value` osm tag
(
node[shop=kiosk]({{bbox}});
way[shop=kiosk]({{bbox}});
rel[shop=kiosk]({{bbox}});
);
(._;>;);
out;
@xkr47
xkr47 / gulpfile.js
Last active Aug 17, 2017
Simple gulp debug transform
View gulpfile.js
var gt = require('through-gulp');
//...
gulp.src("...")
.pipe(/*...*/)
.pipe(gt(function visitFile(file, enc, cb) {
console.log("file '" + file.path + "' contents: " + file.contents.toString());
cb(null, file);
}, function visitEnd(cb) {
console.log("No more files");
cb();
You can’t perform that action at this time.