Skip to content

Instantly share code, notes, and snippets.

@holmboe
holmboe / README.md
Last active April 20, 2020 10:44
An experimental Wildfly SELinux policy

An experimental Wildfly SELinux policy

@holmboe
holmboe / worktime
Last active January 10, 2019 09:44
#!/bin/sh
# -*- coding: utf-8; mode: sh -*-
current_time=$(date -d 'now' +%s)
lid_opened=$(date -d "$(journalctl -t systemd-logind -b | grep 'Lid opened' | tail -n1 | awk '{print $1, $2, $3}')" +%s)
worked_hours=$(echo 'scale=2;(' $current_time - $lid_opened ')' / 3600 | bc)
echo 'You have worked:' $worked_hours 'hours'
#!/usr/bin/env python
# Generate OpenStack flavor permutations
# The flavor name can be generated easily with Bash, but then we wouldn't get
# the corresponding RAM in MB, etc that is required by the `openstack flavor`
# command.
#
# Roughly equivalent:
# echo {1C,2C,4C,8C}-{0.5GB,1GB,2GB,4GB,8GB,16GB,32GB,64GB,128GB}-{5GB,10GB,20GB,40GB}
@holmboe
holmboe / arrangedisplays
Last active February 12, 2018 09:05
Arrange displays using xrandr
#!/usr/bin/env bash
# -*- coding: utf-8; mode: sh -*-
set -o nounset
set -o errexit
#? arrangedisplays -- set up displays using xrandr
#? Copyright (C) 2018 Henrik Holmboe
#? License CC0 1.0 Universal
#?
@holmboe
holmboe / junkfind
Last active October 19, 2017 09:43
Search Spacemacs junk files
#!/usr/bin/env bash
# -*- coding: utf-8; mode: sh -*-
set -o nounset
set -o errexit
#? junkfind -- list Spacemacs junk files
#? Copyright (C) 2017 Henrik Holmboe
#? License CC0 1.0 Universal
#?
#? 2017-04-24: Initial version

Keybase proof

I hereby claim:

  • I am holmboe on github.
  • I am holmboe (https://keybase.io/holmboe) on keybase.
  • I have a public key whose fingerprint is F67B 24EC 58E9 5563 0DFA 68D3 F5DE 4A8B 2AA6 ACB6

To claim this, I am signing this object:

@holmboe
holmboe / formulas.py
Last active January 8, 2022 17:08
A meta-repository that collects all Salt formula repositories at https://github.com/saltstack-formulas
#!/usr/bin/env python
'''
Tool to manage a local copy of formulas (https://github.com/saltstack-formulas).
'''
import base64
import contextlib
import logging
import os
import re
@holmboe
holmboe / saltapi.py
Created March 18, 2013 20:12
Some proposed changes to saltapi/__init__.py
'''
Make api awesomeness
'''
# Import Python libs
import inspect
# Import Salt libs
import salt.client
import salt.runner
import salt.wheel
@holmboe
holmboe / tests.py
Last active December 14, 2015 18:59
Test code for django-saltapi. Put this file in the same directory as models.py. This code might never be put into the source tree, pending whether another test suite (https://gist.github.com/holmboe/5129722) will be used instead.
# -*- coding: utf-8 -*-
# NOTE: A models.py file must exist, even if empty, or the test suite
# will not run! See django/django#7198.
# Usage examples:
#
# manage.py test django_saltapi
# manage.py test django_saltapi.testPing
# manage.py test -v 3 django_saltapi
@holmboe
holmboe / test-saltapi.py
Last active December 14, 2015 18:29
A WIP to test the Salt (http://www.saltstack.org) REST API. The ambition is to have a framework/implementation independent test suite for the API. This will allow easy verification of API implementations such as salt-api (http://github.com/saltstack/salt-api) and django-saltapi (http://github.com/holmboe/django-saltapi).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Usage examples:
#
# test-saltapi
# test-saltapi testPing
# VERBOSITY=9 test-saltapi
# VALID_TARGETS="salt min1 min2" test-saltapi testMinions