Skip to content

Instantly share code, notes, and snippets.

View lwille's full-sized avatar
🏳️‍🌈
🤠

Leonhardt Wille lwille

🏳️‍🌈
🤠
View GitHub Profile
@lwille
lwille / mongosync-controller.py
Last active June 20, 2023 10:13
A utility to get progress information from mongosync running inside kubernetes pods, and send API commands to them
#!/usr/bin/env python3
"""
Copyright 2023 Leonhardt Wille / The Jodel Venture GmbH.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@lwille
lwille / generate-jenkins-token.groovy
Created February 28, 2022 11:06
Jenkins: generate API token for another user
import hudson.model.*
import jenkins.model.*
import jenkins.security.*
import jenkins.security.apitoken.*
def user = User.get("jane-doe", false)
def prop = user.getProperty(ApiTokenProperty.class)
def forceRecreate = false
if(!prop || forceRecreate) {
@lwille
lwille / enable-builds.groovy
Last active February 6, 2020 14:17
Jenkins script console: enable specific builds
import com.cloudbees.hudson.plugins.folder.Folder
import groovy.transform.Field
import hudson.model.*
import org.jenkinsci.plugins.workflow.job.WorkflowJob
@Field def fmt = "%-40s | %-10s | %-20s | %-20s | %-10s\n"
printf(fmt, "job", "branch", "queue time/status", "label", "last build")
printf(fmt, '-' * 40, '-' * 10, '-' * 20, '-' * 20, '-' * 10)
enableBuilds(Hudson.instance.items, 'INFRA-925', false)
#!/bin/bash
# Prerequisites:
# - `/bin/bash` and `shasum` available in pod
function wait_k8sync() {
local pod=$1
local file_local=$2
local file_remote=$3
@lwille
lwille / 2019-otg-apps_android+ios.md
Last active June 12, 2019 12:35
2019 Mesh/off-grid communication apps for iOS+Android interoperability

Keybase proof

I hereby claim:

  • I am lwille on github.
  • I am lwille (https://keybase.io/lwille) on keybase.
  • I have a public key ASB44SRQ25uZN-2kWzloH0OxPqj3TZVUisJH2lhWuJ11ogo

To claim this, I am signing this object:

@lwille
lwille / StIdNr-Validierung.js
Created February 15, 2013 13:45
Validierung der deutschen Steueridentifikationsnummer
number = '9132456781'.split('');
validation = number.pop();
var n = 11,
m = 10,
product = m,
sum = 0;
console.log("StIdNr: %s, validation: %s", number.join(''),validation);
for (var i in number) {
var c = parseInt(number[i], m);
#!/usr/bin/env python
import os, sys
try:
import boto.s3
from boto.s3.key import Key
Key.change_storage_class
except ImportError, e:
sys.stderr.write('Package boto (svn rev. >= 1595) must be installed.\n')
sys.exit(1)
@lwille
lwille / client_main.coffee
Created October 20, 2012 22:12
pretty clean way of obtaining reactive item counts in meteor
Meteor.autosubscribe ->
Meteor.call 'getItemCount', Session.get('currentCustomer'), (err, count)->
Session.set 'itemCount', count
@lwille
lwille / subscriptions.coffee
Created September 12, 2012 03:01
publish count
shotAccessControl = (userId, selector, customer)->
if current_user = Meteor.users.findOne userId
if customer and (current_user.role is 'admin' or (current_user.customers and customer in current_user.customers))
customer = Customers.findOne(customer)
not customer.deleted if customer
shotSelector = (selector, customer)->
$and: [
$and:[
(completed: true),