Skip to content

Instantly share code, notes, and snippets.

View mikerowehl's full-sized avatar

Mike Rowehl mikerowehl

View GitHub Profile
@mikerowehl
mikerowehl / test.go
Created October 24, 2020 20:58
Validating a JWT from Google Sign-in using jwt-go
package main
import (
"encoding/json"
"fmt"
"gopkg.in/dgrijalva/jwt-go.v3"
"io/ioutil"
"net/http"
"os"
)
- name: Run tests
run: |
docker exec -i ${{ job.services.postgres.id }} psql -U postgres postgres < dbinit/testinit.sql
test_script
@mikerowehl
mikerowehl / sample.sh
Created September 10, 2020 20:51
How to build the OSDev wiki Meaty Skeleton sample with a set of tools I packaged called ktool
# Download the source for the Meaty Skeleton sample
git clone https://gitlab.com/sortie/meaty-skeleton.git
cd meaty-skeleton/
# Download the ktool wrapper script and make it executable
curl -O https://raw.githubusercontent.com/mikerowehl/ktool/master/ktool
chmod +x ktool
# Run the Meaty Skeleton build inside the container used by ktool.
# The container will be downloaded automatically on first run.
@mikerowehl
mikerowehl / gist:ffaad752adc98a6286c6297d0a63c44b
Last active September 4, 2020 22:37
Compiling boot sector from assembly and C++ using a Docker cross-compile toolchain
# Assuming you have boot4.asm, kmain.cpp, and linker.ld from
# http://3zanders.co.uk/2017/10/18/writing-a-bootloader3/
# already in your working directory and you have nasm and qemu
# installed locally
nasm -f elf32 boot4.asm -o boot4.o
docker run --rm dockcross/linux-x86 > ./dockcross
chmod +x dockcross
./dockcross g++ -m32 kmain.cpp boot4.o -o kernel.bin -nostdlib \
-ffreestanding -std=c++11 -mno-red-zone -fno-exceptions \
INFO [03-01|19:05:22] Imported new state entries count=768 elapsed=6.393ms processed=2766749 pending=5709 retry=0 duplicate=511 unexpected=3854
INFO [03-01|19:05:27] Imported new state entries count=768 elapsed=6.091ms processed=2767517 pending=5596 retry=0 duplicate=511 unexpected=3854
INFO [03-01|19:05:27] Imported new state entries count=384 elapsed=2.305ms processed=2767901 pending=9380 retry=0 duplicate=511 unexpected=3854
INFO [03-01|19:05:28] Imported new state entries count=384 elapsed=6.56µs processed=2768285 pending=14259 retry=0 duplicate=511 unexpected=3854
INFO [03-01|19:05:29] Imported new state entries count=1920 elapsed=10.688ms processed=2770205 pending=13772 retry=0 duplicate=511 unexpected=3854
INFO [03-01|19:05:31] Imported new state entries count=1920 elapsed=11.732ms processed=2772125 pending=12895 retry=0 duplicate=511 unexpected=3854
INFO [03-01|19:05:31] Imported new block
INFO [03-01|06:50:53] Upgrading chain index type=bloombits percentage=96
INFO [03-01|06:51:01] Upgrading chain index type=bloombits percentage=97
INFO [03-01|06:51:10] Upgrading chain index type=bloombits percentage=99
INFO [03-01|06:51:15] Finished upgrading chain index type=bloombits
INFO [03-01|06:51:20] Imported new block headers count=1 elapsed=5.546ms number=5175833 hash=41bf50…6dd455 ignored=0
INFO [03-01|06:51:28] Imported new state entries count=519 elapsed=13.038µs processed=7924 pending=10563 retry=0 duplicate=18 unexpected=266
INFO [03-01|06:52:05] Imported new block headers count=1 elapsed=5.521ms number=5175834 hash=dc26c0…0dd59c ignored=0
INFO [03-01|06:52:18] Imported new block headers count=1 elapsed=5.344ms number=5175835 hash=889153…c5b20e ignored=0
INFO [03-01|06:52:25] Imported new block headers count=1 elapsed=5.852ms number=5175836
@mikerowehl
mikerowehl / gist:7d38fb640b9315f2d855972abccb1e72
Created February 13, 2018 22:19
Jenkins trigger exception
"trigger" : {
"enabled" : true,
"id" : null,
"type" : "jenkins",
"master" : "Armory Jenkins",
"job" : "Spinnaker_HelloDeploy_Cron",
"buildNumber" : 12678,
"propertyFile" : null,
"cronExpression" : null,
"source" : null,
@mikerowehl
mikerowehl / ACA-failure.json
Created February 7, 2018 21:27
ACA failure
{
"application": "armoryhellodeploy",
"authentication": {
"allowedAccounts": [
"gcr",
"kubernetes",
"dockerhub",
"my-account-name",
"aws-staging",
"aws-dev",
@mikerowehl
mikerowehl / models.py
Created September 5, 2017 18:51
Patch to Winnaker models.py to deal with stale element references
diff --git a/winnaker/models.py b/winnaker/models.py
index 47a2109..4682cae 100644
--- a/winnaker/models.py
+++ b/winnaker/models.py
@@ -151,32 +151,41 @@ class Spinnaker():
int(cfg_max_wait_for_pipeline_run_mins / 60)))
logging.error("Considering it as an error")
sys.exit(1)
- status = self.get_last_build().status
- if "RUNNING" in status:
@mikerowehl
mikerowehl / gist:336ed466cc50d069f3f6
Created June 26, 2015 20:56
Explicit loop with conditionals
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Get tag Name where exists
debug: msg="Host {{ item }} is tagged with {{ hostvars[item]['ec2_tag_Name'] }}"
with_items: groups.all
when: hostvars[item]['ec2_tag_Name'] is defined
- name: Output hosts without name