Skip to content

Instantly share code, notes, and snippets.

View mattiasb's full-sized avatar

Mattias Bengtsson mattiasb

View GitHub Profile
@mattiasb
mattiasb / custom.el
Last active November 8, 2024 12:47
Emacs config binding forge-create-issue
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-file (file-name-concat user-emacs-directory "custom.el"))
'(delete-selection-mode t)
'(fill-column 80)
'(inhibit-startup-buffer-menu t)
'(inhibit-startup-screen t)
@mattiasb
mattiasb / build.el
Created September 3, 2024 12:15
Building my packages
#!/usr/bin/emacs -x
;; -*- flymake-diagnostic-functions: nil; -*-
(setq user-emacs-directory (locate-dominating-file load-file-name ".git"))
(load (file-name-concat user-emacs-directory "early-init.el"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'package)
(require 'package-vc)
@mattiasb
mattiasb / automatic.sh
Last active August 7, 2024 11:42
Setting GNOME keybindings with gsettings
#!/bin/bash
set -e
set -o pipefail
################################################################################
function gnome-keybinding {
echo gsettings set org.gnome.desktop.wm.keybindings "${@}"
}
@mattiasb
mattiasb / Makefile
Last active December 28, 2021 06:44
OpenWRT Image Builder Raspberry Pi 4 Makefile
VERSION=21.02.1
TARGET=bcm27xx-bcm2711
PROFILE=rpi-4
PACKAGES=kmod-usb-net-rtl8152 luci luci-ssl
FILESYSTEM=ext4
###################
BUILDER_BASEURL=https://downloads.openwrt.org/releases/$(VERSION)/targets/$(subst -,/,$(TARGET))
BUILDER_TARBALL=openwrt-imagebuilder-$(VERSION)-$(TARGET).Linux-x86_64.tar.xz
@mattiasb
mattiasb / Output
Created December 11, 2020 17:09
Ansible some tasks don't prepend role name
TASK [check : Type Checking mount field in storage_lvm_volumes] **********
ok: [machine-test.local] => (item={'path': '/'}) => changed=false
ansible_loop_var: item
item:
path: /
msg: All assertions passed
TASK [storage : check : Type Checking bools] *****************************
ok: [machine-test.local] => changed=false
msg: All assertions passed
@mattiasb
mattiasb / Vagrantfile
Created December 10, 2020 13:40
Vagrantfile: Theoretical change to shell provisioner to allow changing guest ssh port
config.vm.define "git.local" do |server|
server.vm.hostname = "git.local"
server.ssh.port = 2222
# The ssh_port field doesn't exist in Vagrant, but would make it possible to
# change guest ssh port during provisioning.
server.vm.provision "shell", ssh_port: 22, inline: <<-SHELL
set -ex
sed -i -Ee 's/^[[:blank:]]*#[[:blank:]]*Port[[:blank:]]+22$/Port 2222/' \
/etc/ssh/sshd_config
systemctl restart sshd.service
@mattiasb
mattiasb / Jenkins log
Created March 2, 2020 14:20
Jenkins dind
Started by user Mattias Bengtsson
Running in Durability level: PERFORMANCE_OPTIMIZED
[Pipeline] Start of Pipeline
[Pipeline] node
Running on builder22_Linux in /home/company/jenkins/workspace/Experiments/mattiasb/DockerTest
[Pipeline] {
[Pipeline] isUnix
[Pipeline] sh
+ docker inspect -f . node:7-alpine
.
@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()
}