Skip to content

Instantly share code, notes, and snippets.

@ctran
ctran / config.yml
Created March 15, 2023 13:43 — forked from rwp0/config.yml
GH CLI Transfer Repository Ownership Alias
# ~/.config/gh/config.yml
# What protocol to use when performing git operations. Supported values: ssh, https
git_protocol: https
# What editor gh should run when creating issues, pull requests, etc. If blank, will refer to environment.
editor:
# When to interactively prompt. This is a global config that cannot be overridden by hostname. Supported values: enabled, disabled
prompt: enabled
# A pager program to send command output to, e.g. "less". Set the value to "cat" to disable the pager.
pager:
@ctran
ctran / README.md
Last active April 27, 2023 03:17
Run curl with some timing

This can be run with

bash <(https://gist.githubusercontent.com/ctran/3f0d681a1ae12622f4f397cbfeac3750/raw/ea4a47fdb7f0e56009f4265c231fe22035effffe/curltime) url

or

curl -s https://gist.githubusercontent.com/ctran/3f0d681a1ae12622f4f397cbfeac3750/raw/ea4a47fdb7f0e56009f4265c231fe22035effffe/curltime) | bash -s url
#!/bin/bash
## The following is automatically generated code, do not manually modify.
## Template is available in # scripts/commons-templates.sh
## START AUTOGENERATED CODE
# shellcheck disable=SC2034
SCRIPT_VERSION=1630078691
# Useful variables
@ctran
ctran / filesize.groovy
Last active October 14, 2020 19:07
filesize to human
// Convert a number of bytes to a more readable string
// Written this way (with attrs), as I was using it for a Grails taglib
def filesize = {
attrs ->labels = [' bytes', 'KB', 'MB', 'GB', 'TB']
size = attrs.size
label = labels.find {
if (size < 1024) {
true
}
else {
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
@ctran
ctran / README.md
Created May 31, 2019 22:14 — forked from twolfson/README.md
Setting up SOPS

I'm learning about SOPS and setting it up as my preferred mechanism for storing secrets. Here are my notes.

PGP

It’s security mechanism is that we (i.e. client) use a PUBLIC key from the receiver (i.e. server) and encode it with a random key (I’m saying nonce but it could be reused)

This varies from RSA and SSH because the server uses a PUBLIC key to identify the client.

Web of trust

Web of trust operates by still using PGP (i.e. encoding with recipient’s public key) but additionally, we can encrypt/sign the data as our own by signing it with the client’s private key.

This means the recipient will initially decrypt via our (i.e. client’s) public key (verifying the source) and then decrypting via their (i.e. server’s) private key to get the data.

pipeline {
agent none
options {
buildDiscarder logRotator(numToKeepStr: '10')
}
triggers {
eventTrigger jmespathQuery("repository.full_name")
@ctran
ctran / multi_brach_dsl_with_custom_strategy_and_script_path.groovy Jenkins Job DSL for a Multi-Branch Pipeline that includes Branch Source Strategy & custom Jenkinsfile script path
UUID uuid = UUID.randomUUID()
multibranchPipelineJob("my_awesome_job") {
displayName "my awesome job"
description "multi-branch pipeline job thingy"
configure {
it / sources / 'data' / 'jenkins.branch.BranchSource' << {
source(class: 'jenkins.plugins.git.GitSCMSource') {
id(uuid)
remote("git@gitlab:root/repo.git")
@ctran
ctran / pipeline.groovy
Created April 27, 2018 06:37 — forked from paulchubatyy/pipeline.groovy
Jenkins pipeline to read the repository list for Github Organization and create multibranch pipeline projects for them
import org.kohsuke.github.*
/*
* This pipeline uses the Jenkins Job DSL plugin to create the multi-branch pipelines
* for your Github Organization repositories.
*
* @see https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin
*
* It does not consumes 5k requests in 6 minutes, but actually queries the Github API
* for the repositories in organization and creates the Multi-Branch Pipelines in Jenkins.
@ctran
ctran / good-email-rules.md
Created December 4, 2017 18:52
Rules for good emails
  1. Keep the message as short as necessary but no shorter.
  2. Put the most important information at the top of the message.
  3. If it email is for an ask, call out from who you need the response and put it at the top of the message.
  4. If you need to send a long email with many details, put the most important information at the top (ie. what the reader needs to know) and then fill in the body with details he/she can choose to indulge.

Example:

Hey Jane, I need your input on how to prioritize my current work. Can you provide guidance on where I should focus? Bug XYZ was assigned to me and it's taking longer to complete because we have a dependency on Vendor ABC completing a change to their web service. This is impacting the commitment to my team on Feature 123 because we are near the end of our sprint.