Skip to content

Instantly share code, notes, and snippets.

@rtyler
rtyler / github-backup.py
Created Jan 29, 2021
A simple Python script for copying an organization's repositories
View github-backup.py
#!/usr/bin/env python3
#
# Requires https://pygithub.readthedocs.io/en/latest
#
# Set the GITHUB_TOKEN to a personal access token with all repo scopes
import os
import subprocess
import sys
@rtyler
rtyler / 0_readme.adoc
Created Dec 7, 2020
I want your Jenkins declarative pipeline!
View 0_readme.adoc

I want your Declarative Pipeline!

I’m working on a grammar and parser for declarative Jenkins Pipelines called Jenkins Declarative Parser. In order to make this parser work well, I need real-world declarative `Jenkinsfile`s, that’s where you come in!

If you have a Jenkinsfile which you’re allowed to share publicly, follow these steps:

  • Create a new directory inside the data/valid directory

  • Add your Jenkinsfile to the directory

@rtyler
rtyler / 0_about.adoc
Created Nov 27, 2020
An example of Otto running its own tests
View 0_about.adoc

Sorta-self-hosted Otto

Below is a transcript from a local installation of Otto with the parser service, the "local-orchestrator" service, a local agent, and steps. This is fairly simple, but it represents an end-to-end integration test of Otto 👏

Running

  1. Clone Otto

  2. cargo build

  3. make steps build the steps libraries

@rtyler
rtyler / complex.groovy
Created Nov 7, 2020
Exploring syntax for more root verbs in Otto (.groovy just for syntax highlighting)
View complex.groovy
use stdlib
environment {
}
pipeline {
// Parallel will build all sub-stages concurrently without stopping if one
// fails. Any of the stages failing will halt the pipeline after the parallel
// however
parallel {
@rtyler
rtyler / 0_prereq.adoc
Last active Oct 29, 2020
Simple Otto step library testing
View 0_prereq.adoc

Prerequisites

  • Have a rust compiler set up

  • make steps will package all the steps up for you

  • mkdir tmp && for f in *.tar.gz; do tar -zxvf $f -C tmp; done will prepare the tmp/ directory with those step libraries extracted

Then you should be able ro invoke the test-pipeline.yml with the following command:

@rtyler
rtyler / 0_readme.adoc
Last active Jun 22, 2020
Reproduction steps for a locking issue with async-std 1.6.x and hotdog
View 0_readme.adoc

Reproducing the issue

  • git clone https://github.com/reiseburo/hotdog -b performance-regression-41

  • cd hotdog

  • docker-compose up (not needed for the runtime test, but 🌭 needs Kafka to start)

  • cargo build --release

  • Run 🌭 with RUST_LOG=info ./target/release/hotdog -c hotdog-loadtest.yml

  • In two terminates, paste: ./scripts/generate-stdout.rb 100000 | time openssl s_client -connect localhost:6514

  • Try to run them both in parallel as much as possible.

  • While they’re running, you should see the dots slow in one terminal and even stop.

View client.rb
#!/usr/bin/env ruby
require 'json'
require 'socket'
require 'openssl'
def format_syslog(buffer)
'<13>1 2020-04-18T15:16:09.956153-07:00 coconut tyler - - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="505061"] ' + buffer + "\n"
end
@rtyler
rtyler / 0.log
Created Jun 6, 2020
Playing around with syntax sugar around handling websocket messages
View 0.log
INFO otto_eventbus > Listening for WebSocket connections on 127.0.0.1:9311
DEBUG tungstenite::handshake::server > Server handshake done.
DEBUG otto_eventbus > Received: Ok(Text("{\"type\":\"ping\", \"value\" : {\"msg\":\"hi\"}}"))
INFO otto_eventbus > deser: Meow { ttype: "ping", value: Object({"msg": String("hi")}) }
DEBUG otto_eventbus > Handling: Ping { msg: "hi" }
DEBUG otto_eventbus > Received: Ok(Text("{\"type\":\"hello\",\"value\": null}"))
INFO otto_eventbus > deser: Meow { ttype: "hello", value: Null }
DEBUG otto_eventbus > Handling hello: Hello
@rtyler
rtyler / 0_readme.adoc
Last active May 25, 2020
trying to reproduce a BufReader error in async_std.
View 0_readme.adoc

Reproducing errors in async-std/async-tls

The binary and client.rb can both be run in plaintext mode (no arguments) and everything will work out fine. When both are run with the tls argument, the error can be reproduced, e.g ruby client.rb tls and ./target/debug/big-async-reader tls

---
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `32768`,
 right: `0`', <::std::macros::panic macros>:5:6
stack backtrace:
@rtyler
rtyler / gitlab-to-csv.sh
Created Apr 2, 2020
Generate a CSV dump of project information from GitLab
View gitlab-to-csv.sh
#!/bin/bash
#
# This script can be used as a starting point for generating a spreadsheet of
# GitLab projects, with their properties, from an existing GitLab instance
#
# You must set a GitLab access token via the GITLAB_TOKEN env variable
#
# Invoke with ./gitlab-to-csv.sh <gitlab hostname>