Skip to content

Instantly share code, notes, and snippets.

View mattiasb's full-sized avatar

Mattias Bengtsson mattiasb

View GitHub Profile
@mattiasb
mattiasb / Testkörning
Last active November 14, 2019 21:08
Enkel Python
$ python3 ./hej.py
Hello Pelle!
Hello Pelle!
Hello Kalle!
Hello Kalle!
@mattiasb
mattiasb / shuffler.cs
Last active September 15, 2019 02:07
Shuffler example
using System.Linq;
using System.Collections.Generic;
using System;
public class UniqueRandom {
private HashSet<int> intSet = new HashSet<int>();
private Random rng;
public UniqueRandom(Random rng) {
this.rng = rng;
@mattiasb
mattiasb / Jenkinsfile
Last active March 23, 2018 13:21
Will I get the same agent?
// In the following pipeline the stages that start with 'Build: ' needs to run
// on the same node and in the same workspace, the same is true for the stages
// that begin with 'Test: '
// Will this be the case as the pipeline is written?
// If not, can I force the pipeline to do so?
pipeline {
options {
skipDefaultCheckout()
}
#!/bin/bash
function _help-flag() {
[[ " ${@} " == *" --help "* ]] || [[ " ${@} " == *" -h "* ]]
}
if _help-flag "${@}" || [ $# -lt 3 ] ; then
echo "Usage: ${0} <STR1> <STR2> FILE..."
echo
echo "Rename a bunch of files by replacing STR1 with STR2 in their filename."
@mattiasb
mattiasb / compile_commands.json
Created April 8, 2017 16:48
Compiling libchamplain with `bear -n make` under JHBuild
[
{
"command": [
"/bin/sh",
"-c",
"fail=; \\\nif (target_option=k; case ${target_option-} in ?) ;; *) echo \"am__make_running_with_option: internal error: invalid\" \"target option '${target_option-}' specified\" >&2; exit 1;; esac; has_opt=no; sane_makeflags=$MAKEFLAGS; if { if test -z '0'; then false; elif test -n 'x86_64-redhat-linux-gnu'; then true; elif test -n '4.1' && test -n '/home/mattiasb/Code/gnome/build/libchamplain'; then true; else false; fi; }; then sane_makeflags=$MFLAGS; else case $MAKEFLAGS in *\\\\[\\ \\\t]*) bs=\\\\; sane_makeflags=`printf '%s\\n' \"$MAKEFLAGS\" | sed \"s/$bs$bs[$bs $bs\t]*//g\"`;; esac; fi; skip_next=no; strip_trailopt () { flg=`printf '%s\\n' \"$flg\" | sed \"s/$1.*$//\"`; }; for flg in $sane_makeflags; do test $skip_next = yes && { skip_next=no; continue; }; case $flg in *=*|--*) continue;; -*I) strip_trailopt 'I'; skip_next=yes;; -*I?*) strip_trailopt 'I';; -*O) strip_trailopt 'O'; skip_next=yes;; -*O?*) strip_trailopt
bd = "!f() { git for-each-ref --sort=committerdate refs/heads/ --format='%(refname:short):%(committerdate:relative)'; }; f | column -t -s ':'"
@mattiasb
mattiasb / git-spindle.completion.bash
Created May 2, 2015 00:56
Current snapshot of git-spindle.completion.bash
#!/bin/bash
# Copyright ⓒ 2015 Mattias Bengtsson
#
# git-spindle is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# git-spindle is distributed in the hope that it will be useful,
@mattiasb
mattiasb / twitch.lua
Created January 5, 2015 04:56
Twitch.tv grilo plugin
--[[
* Copyright (C) 2015 Mattias Bengtsson
*
* Contact: Mattias Bengtsson <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; version 2.1 of
* the License, or (at your option) any later version.
*
@mattiasb
mattiasb / templates-discussion
Created November 10, 2014 15:47
Templates discussion
mattiasb Is it possible to put your own custom classes inside
gtkbuilder ui-files? Or do you need to do work on the
gtkbuilder side for that to work?
baedert you mean custom widgets?
mattiasb And if it works: does it also work for, say, gjs?
mattiasb baedert: ah, yeah exactly
xjuan mattiasb, yes you can
xjuan what I do not remember is if you need to have your
class referenced or not
mattiasb What I'm after is to have a main-window.ui file be a
From 9f923390a77e9d5b950f100e2194c4b084a2a0bb Mon Sep 17 00:00:00 2001
From: Mattias Bengtsson <[email protected]>
Date: Tue, 28 Oct 2014 00:48:27 +0100
Subject: [PATCH] WIP: Template of layers-popover
---
src/layers-popover.ui | 93 +++++++++++++++++++++++++++------------------------
src/layersPopover.js | 21 +++++++-----
2 files changed, 62 insertions(+), 52 deletions(-)