Skip to content

Instantly share code, notes, and snippets.

View ftclausen's full-sized avatar

Friedrich Clausen ftclausen

View GitHub Profile
Connecting to computer.example.com
Checking if Java exists
java -version returned 1.8.0.
Installing the Jenkins slave service
Copying jenkins-slave.exe
Copying slave.jar
Copying jenkins-slave.xml
Registering the service
Starting the service
Waiting for the service to become ready
// KA recursion homework assignment. Does a poor man's tunnel animation.
// Also at https://gist.github.com/ftclausen/9d42b2511a82f6d59085e70d204cf5b7
// drawShape() will draw a series of circles, each one
// smaller than the last until we hit a radius of 7 or less
var drawShape = function(x, y, radius) {
// The base case - quit when we have a radius of 7
if (radius <= 7) {
return;
}
@ftclausen
ftclausen / khan_academy_recursion_project_l_systems.js
Last active September 2, 2016 06:52
Attempt at generating an L-System based pythagoras-like tree
var maxIterations = 3;
var currentIteration = 0;
var pythagorasTree = function(string, subIteration) {
// Because processing JS does not seem to like default parameters
if (!subIteration) {
currentIteration += 1;
}
if (currentIteration > maxIterations) {
println("Reached max iterations");

Keybase proof

I hereby claim:

  • I am ftclausen on github.
  • I am ftclausen (https://keybase.io/ftclausen) on keybase.
  • I have a public key ASAe4Q4yjdm6jeLJIgcWfY6K0pxqWk8vSLROpSyh25g5Vgo

To claim this, I am signing this object:

@ftclausen
ftclausen / Jenkinsfile
Created April 13, 2017 05:36
Jenkins pipeline - An approach to get all commits since the last successful build.
// -*- mode: groovy -*-
// vim: set filetype=groovy :
node( 'some_node' ) {
stage( "Phase 1" ) {
sshagent( credentials: [ 'some_creds' ] ) {
checkout scm
def lastSuccessfulCommit = getLastSuccessfulCommit()
def currentCommit = commitHashForBuild( currentBuild.rawBuild )
if (lastSuccessfulCommit) {
@ftclausen
ftclausen / restic_wrapper.sh
Last active June 11, 2019 00:04
restic_wrapper.sh
#!/usr/bin/env bash
# Friedrich "Fred" Clausen - ftclausen@gmail.com
source_directories=("/var/tmp/inc_test" "/var/tmp/inc test 2")
remote="sftp:md:tmp/inc_test"
passwd="/tmp/pw"
report_location="/tmp"
log="$(mktemp -t backup_report_)"
sftp_log="$(mktemp)"
@ftclausen
ftclausen / list_restic_files.sh
Last active June 10, 2019 23:28
List restic files
# List all files in all restic snapshots
repo="sftp:example.com:/path/to_repo"
passwd_file="/tmp/pw"
restic -r $repo --password-file $passwd_file snapshots -c | awk '/^[0-9a-f]{8}/ {print $1}' | while read -r snap; do
restic -r $repo --password-file $passwd ls $snap
done
@ftclausen
ftclausen / jenkins-pipeline-mocks.groovy
Last active August 10, 2023 03:34
Jenkins pipeline very simple mock steps to test things in a standalone script
# For a more realistic simulation see https://stackoverflow.com/questions/50165079/mocking-jenkins-pipeline-steps
def readFile( Map args ) {
def file = args.file
def encoding = args.file ?: 'UTF-8'
return new File( file ).text
}
def sh( String command ) {