Skip to content

Instantly share code, notes, and snippets.

View StFS's full-sized avatar

Stefán Freyr Stefánsson StFS

View GitHub Profile
def numbers = 1..6
def max_splits = 7
count = numbers.size()
overflow = count % max_splits
pergroup = count.intdiv(max_splits)
println "Count: " + count + ", overflow: " + overflow + ", pergroup: " + pergroup
List<String> toollist = // a list of tool ids
Set<String, String> mapToolId = // a map convert ids to fully qualified names
Set<String> fqToolList = toollist.stream()
.peek( n -> { if (!mapToolId.containsKey(n.trim())) logger.warn("Ignoring unexpected tool id value '{}'", n); })
.filter( n -> mapToolId.containsKey(n.trim()) )
.map( n -> mapToolId.get(n.trim())) // map shorthand tool names to fully qualified tool names
.collect( Collectors.toCollection(HashSet::new) ); // make sure we have a mutable set
stefan@atlas-stfs  ~  tracepath postur.hi.is  ✔  4131  18:37:25
1?: [LOCALHOST] pmtu 1500
1: router-stfs.freyr.org 0.908ms
1: router-stfs.freyr.org 0.908ms
2: 10.202.20.2 2.648ms
3: no reply
4: no reply
5: GR-VFIS-1-s28.c.is 2.088ms asymm 6
6: te3-5-D01-Sidumuli.c.is 11.256ms asymm 7
7: te3-5-D01-Sidumuli.c.is 2.705ms
### Keybase proof
I hereby claim:
* I am stfs on github.
* I am stfs (https://keybase.io/stfs) on keybase.
* I have a public key ASBiy-4onUWaB3v0HvdZ2E7JbplckrbuhtZ6kpd6isznago
To claim this, I am signing this object:
@StFS
StFS / use-java.plugin.zsh
Last active May 15, 2018 09:57
oh-my-zsh plugin that sets the JAVA_HOME and path to activate a specified version of a JDK (installed via webupd8 packages). Install in .oh-my-zsh/custom/plugins/use-java/use-java.plugin.zsh
function _use-java_usage() {
echo "Usage use-java VERSION"
echo 'Set the Oracle JDK version to use for the current session.'
echo ''
echo 'The VERSION is the JDK version to use such that'
echo 'the directory /usr/lib/jvm/java-${VERSION}-oracle'
echo 'will be set as JAVA_HOME and the corresponding bin/'
echo 'directory will be added to the front of PATH.'
}
TASK [nextcode-jenkins : pull docker-jenkins image] ****************************
task path: /home/stefan/work/ansible-roles/nextcode-jenkins/tasks/main.yml:22
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/core/cloud/docker/docker_image.py
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2200 -o 'IdentityFile="/home/stefan/work/ansible-roles/nextcode-jenkins/.vagrant/machines/default/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/stefan/.ansible/cp/ansible-ssh-%h-%p-%r 127.0.0.1 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1480550227.14-203686490239185 `" && echo ansible-tmp-1480550227.14-203686490239185="` echo $H
- name: log in to private docker repo
docker_login:
registry: our.docker.repo.com
username: foo
password: bar
- name: pull docker-jenkins image
docker_image:
name: "our.docker.repo.com/jenkins:stfs"
tag: "stfs"
@StFS
StFS / syslog
Created August 3, 2016 18:41
Kubuntu 14.04 overheating and freezing - syslog
Aug 3 17:15:40 hyperion-stfs sensord: Chip: acpitz-virtual-0
Aug 3 17:15:40 hyperion-stfs sensord: Adapter: Virtual device
Aug 3 17:15:40 hyperion-stfs sensord: temp1: 52.0 C
Aug 3 17:15:40 hyperion-stfs sensord: Chip: coretemp-isa-0000
Aug 3 17:15:40 hyperion-stfs sensord: Adapter: ISA adapter
Aug 3 17:15:40 hyperion-stfs sensord: Physical id 0: 49.0 C
Aug 3 17:15:40 hyperion-stfs sensord: Core 0: 48.0 C
Aug 3 17:15:40 hyperion-stfs sensord: Core 1: 49.0 C
Aug 3 17:15:40 hyperion-stfs sensord: Chip: pch_wildcat_point-virtual-0
Aug 3 17:15:40 hyperion-stfs sensord: Adapter: Virtual device
@StFS
StFS / jola.py
Created December 3, 2014 17:24
Jólanördaþraut
import base64, string, urllib
rot13 = string.maketrans("ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz","NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm")
print(urllib.unquote(string.translate(base64.b64decode('VyVQMyVPM3l2YSUyMGElUDMlTjF5dG5mZyUyMCVQMyVPMyVQMyVPMHN5aHRu'), rot13)))