Skip to content

Instantly share code, notes, and snippets.

@holmboe
holmboe / README.md
Last active Apr 20, 2020
An experimental Wildfly SELinux policy
View README.md

An experimental Wildfly SELinux policy

View worktime
#!/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'
View openstack-flavor-permutate.py
#!/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 Feb 12, 2018
Arrange displays using xrandr
View arrangedisplays
#!/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 Oct 19, 2017
Search Spacemacs junk files
View junkfind
#!/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
View keybase.md

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 Jan 8, 2022
A meta-repository that collects all Salt formula repositories at https://github.com/saltstack-formulas
View formulas.py
#!/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 Mar 18, 2013
Some proposed changes to saltapi/__init__.py
View saltapi.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 Dec 14, 2015
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.
View tests.py
# -*- 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 Dec 14, 2015
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).
View test-saltapi.py
#!/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