Skip to content

Instantly share code, notes, and snippets.

@JamesCullum
JamesCullum / zollsoft.json
Last active May 28, 2021
Using the Chrome plugin UI.VISION (https://chrome.google.com/webstore/detail/uivision-rpa/gcbalfbdmfieckjlnblleoemohcganoc), check every 3s on a zollsoft.de calendar if a vaccination appointment for Johnson&Johnson or BionTech is available, and if so, take the first appointment and book it
View zollsoft.json
{
"Name": "zollsoft - vaccine book",
"CreationDate": "2021-5-28",
"Commands": [
{
"Command": "store",
"Target": "3",
"Value": "!timeout_wait",
"Description": ""
},
@JamesCullum
JamesCullum / gitlab-free-rollback-on-issues.sh
Created Jan 21, 2021
Bash script to automatically rollback to the last successful pipeline, by re-running the deployment job of it. Should be run with sufficient time after the previous jobs to make sure the check can properly know if the startup failed or not.
View gitlab-free-rollback-on-issues.sh
#!/bin/bash
if curl --output /dev/null --silent --head --fail "http://127.0.0.1:80"; then
echo "Website appears to be available"
else
echo "Website not available, initiating rollback"
LASTSUCCESSPIPELINE=$(curl -k --silent --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/pipelines?status=success&scope=finished" | jq '.[0].id')
if [ -z "$LASTSUCCESSPIPELINE" ]; then
echo "Cannot get last pipeline id"
@JamesCullum
JamesCullum / import-gitlab-variables.sh
Last active Jan 5, 2021
Import all CI/CD variables from Gitlab API and add them to the bash shell for further usage. Made for Ubuntu. Can be combined neatly with Cloud IDEs such as goormIDE to always load the project CI variables into the editor.
View import-gitlab-variables.sh
#!/bin/bash
# works with /bin/sh as well
# requires sudo permission
apt-get -y install jq
curl --header "PRIVATE-TOKEN: <token>" "https://gitlab.com/api/v4/projects/1/variables" |
jq -c '.[]' |
while IFS=$"\n" read -r c; do
key=$(echo "$c" | jq -r '.key')
val=$(echo "$c" | jq -r '.value')
@JamesCullum
JamesCullum / main.dart
Created Jan 27, 2020
Calculate intermediate point in percentage between two geographic location by latitude / longitude
View main.dart
/*
MIT License
Copyright (c) 2020 JamesCullum (Pseudonym)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@JamesCullum
JamesCullum / untag-old-gitlab-images.py
Last active Oct 31, 2019
Gitlab doesn't have a functionality to automatically untag old images (https://gitlab.com/gitlab-org/gitlab-ce/issues/25322). You can use this script to do that for you using the API from any host with HTTP connection (doesn't require access to the server via SSH). Please be aware that you will need a separate cronjob to purge all untagged images.
View untag-old-gitlab-images.py
#!/usr/bin/env python3
'''
DEVELOPMENT SPONSORED BY
PANASONIC INFORMATION SYSTEMS COMPANY EUROPE
Interested in a job? Apply below:
https://application.job.panasonic.eu/data/ruP0pHQvHrGZJKvL/rc.php?nav=jobsearch&custval12=ite&lang=EN&custval11=PBSEU_GER
'''