Skip to content

Instantly share code, notes, and snippets.

Avatar

Morris Jobke MorrisJobke

View GitHub Profile
@MorrisJobke
MorrisJobke / drone-cleanup.php
Created May 8, 2019 13:34
Script to cleanup drone builds after a given retention period
View drone-cleanup.php
<?php
/*
Script that cleans up old builds of all repos of a drone server.
Dependencies:
$ # having PHP and composer installed
$ composer require "guzzlehttp/guzzle=^6.3"
@MorrisJobke
MorrisJobke / sort-failed-tasks-top.js
Created January 7, 2019 14:39
Script to paste in the web dev tools inside drone to sort failed tasks at top
View sort-failed-tasks-top.js
let parent = document.querySelectorAll('[class*="matrix__list"]')[0];
if (parent) {
document.querySelectorAll('[class*="status_number__failure"]').forEach(item => parent.prepend(item.parentNode.parentNode.parentNode));
}
@MorrisJobke
MorrisJobke / drone-sort-failed-at-top.js
Last active November 28, 2018 22:03
Sorts failed steps in drone at the top
View drone-sort-failed-at-top.js
var parent = document.querySelectorAll('[class*="matrix__list"]')[0];
if (parent) {
document.querySelectorAll('[class*="status_number__failure"]').forEach(item => parent.prepend(item.parentNode.parentNode.parentNode));
}
@MorrisJobke
MorrisJobke / delete-all-foreign-branches.php
Last active January 24, 2018 12:47
Deletes all branches in a git repo of which the last commit is not authored by Morris
View delete-all-foreign-branches.php
<?php
$branchesOutput = shell_exec('git branch | egrep -v "^\\*"');
$branches = explode("\n", $branchesOutput);
foreach ($branches as $branch) {
$branch = trim($branch);
if ($branch === '') {
continue;
}
View ios-8-web-app.html
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@MorrisJobke
MorrisJobke / php.txt
Created November 28, 2017 10:23
PHP versions by linux distribtuion
View php.txt
Ubuntu 16.04 (xenial): 7.0 https://packages.ubuntu.com/xenial/php
Debian 9 (stretch): 7.0 https://packages.debian.org/stretch/php
SUSE Linux Enterprise Server 12: 7.0 https://scc.suse.com/docs/lifecycle/sle/12/modules (Web and Scripting Module)
CentOS/Red Hat 7: 5.4 http://mirror.centos.org/centos/7/os/x86_64/Packages
CentOS/Red Hat 7 with RHSCL: 7.1 https://developers.redhat.com/products/softwarecollections/updates/
@MorrisJobke
MorrisJobke / build.sh
Last active May 9, 2022 01:12
How to build drone
View build.sh
apt install golang-go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
mkdir ~/go
git clone git://github.com/drone/drone.git $GOPATH/src/github.com/drone/drone
cd $GOPATH/src/github.com/drone/drone
make deps
make gen
make build
docker build -t drone/drone:0.5 .
@MorrisJobke
MorrisJobke / sum.js
Created February 8, 2017 18:27
Sum up some values
View sum.js
$('[field="amount_usdollar"]')
.map(function(index, value){
return $(value)
.text()
.trim()
.replace(',', '')
.replace('€','');
})
.toArray()
.map(function(value){
@MorrisJobke
MorrisJobke / deploy-etherpad.sh
Last active October 30, 2021 18:28
Deploy stuff on dokku
View deploy-etherpad.sh
ssh dokku@example.org apps:create pad
ssh dokku@example.org mariadb:create pad
ssh dokku@example.org mariadb:import pad < ~/backup.sql
ssh dokku@example.org mariadb:link pad pad
ssh dokku@example.org config:set pad ETHERPAD_SETTINGS=settings.json
git clone git@github.com:bright-star/etherpad-lite-heroku
cd etherpad-lite-heroku
git remote add dokku dokku@example.org:pad
@MorrisJobke
MorrisJobke / timelapse.md
Created December 23, 2016 13:28
Creating a timelapse out of an images series
View timelapse.md

Creating a timelapse out of an images series

Bring them into a common naming format (ordered by date):

jhead -n%Y-%m-%d.%H-%M-%S *.JPG

Create a timelapse video out of those images: