Skip to content

Instantly share code, notes, and snippets.

View samrocketman's full-sized avatar

Sam Gleske samrocketman

View GitHub Profile
@samrocketman
samrocketman / rsa_decrypt.groovy
Last active December 3, 2018 13:09
Jenkins script console decrypt base64 encoded string
//http://www.mysamplecode.com/2011/08/java-rsa-encrypt-string-using-bouncy.html
import jenkins.bouncycastle.api.PEMEncodable
import static jenkins.bouncycastle.api.PEMEncodable.decode
import hudson.util.Secret
import java.util.Base64
import org.bouncycastle.crypto.engines.RSAEngine
import org.bouncycastle.crypto.AsymmetricBlockCipher
import org.bouncycastle.crypto.params.AsymmetricKeyParameter
@samrocketman
samrocketman / slow_drives.md
Last active March 6, 2018 14:49
drive testing

reliability testing

I bought 4 SSD drives. I'm going to open 8 terminals (2 for each drive) to infinitely write to the drives over and over again.

2 terminals writing at the same time:

  • 1 for writing zeros to the drive
  • 1 for writing random 1's and 0's to the drive

I'm going to let the drives write for anywhere from three to five days 24 hours a day. If the drives are bad then they should fail within that window.

@samrocketman
samrocketman / decode_windows_key.vbs
Created January 23, 2018 08:08
How to recover product keys in Windows
' Windows product keys are base24 encoded
' source: https://ngb.to/threads/26224-Key-offline-aus-Backup-auslesen
' registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId
wscript.echo (ConvertToKey (Inputbox("Key-String","Eingabe bitte")))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
@samrocketman
samrocketman / docker-compose.yml
Last active January 10, 2022 19:26
Vault UI + HA Vault + HA Consul + dnsmasq + service discovery for all the things
version: '2.2'
#define internal docker networks for container connectivity
networks:
internal:
driver: bridge
ipam:
driver: default
config:
@samrocketman
samrocketman / jenkins_high_availability.md
Last active September 16, 2020 14:36
Researching on Jenkins in a high availability configuration.
@samrocketman
samrocketman / logparse-simple-rules.txt
Created March 27, 2018 02:44
Rules for the parsed console output Jenkins plugin.
start /^\+.* make/
ok /^PASS/
ok /\[OK\]/
ok /make.*Error.*ignored/
ok /Status and Error see/
warning /\.\.\. no/
warning /warning\:/
error /\bError\b/
error /^FAIL/
@samrocketman
samrocketman / gimp-troubleshooting.md
Last active May 31, 2018 02:01
Troubleshooting gimp-master builds.

Prepare Docker environment

git clone https://github.com/gimp-ci/docker-jenkins-gimp
cd docker-jenkins-gimp/
make volumes
make GIMP_BRANCH=b4e5b4ae91dea4e8123e5289c1b4cf66875ff3dc interactive

Download dependencies

@samrocketman
samrocketman / install_and_migrate_qgis.md
Last active October 20, 2019 22:00
This guide covers installing QGIS and migrating projects from QGIS 2.x to QGIS 3.x

This guide covers

Migrating from QGIS 2.x to QGIS 3.x

  1. Keep a backup copy of your QGIS 2.x projects before you attempt to open them in QGIS 3.x.
  2. Review what plugins you rely on. I saw in the documentation that not all plugins have been ported to QGIS 3 so you might not be able to use it if you depend on a specific plugin for your work and it isn't available for QGIS 3.

Matrix building in scripted pipeline

In my project, Jervis, it supports Matrix building via YAML using Jenkins scripted pipeline. However, it is quite easy to calculate matrix building using the cartesian product on a list of lists containing maps (the matrix axes).

For user pipelines the following script approvals must be allowed:

staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods combinations java.util.Collection
import groovy.json.JsonSlurper
// criteria
String title_contains = 'DevOps' // required
String salary_currency = 'USD' // or null; example: CAD, CHF, DKK, EUR, GBP, HKD, INR, NZD, PHP, USD
String company_location = 'US' // or null; example: AT, BG, CA, CH, CR, DE, DK, ES, FR, GB, IL, IN, IT, LT, NL, NZ, PH, PT, RO, RU, US
Boolean display_usd = true // false for native currency
List salaries = new JsonSlurper().parse(new File('/home/sam/Downloads/salaries.json'))