Skip to content

Instantly share code, notes, and snippets.

View majorsilence's full-sized avatar
🐢
I may be slow to respond.

Peter Gill majorsilence

🐢
I may be slow to respond.
View GitHub Profile
@majorsilence
majorsilence / Jenkinsfile
Created February 13, 2022 22:24
Go Jenkins Pipeline
pipeline {
agent none
stages {
stage('build and test') {
agent {
docker {
image 'golang:1.16'
}
}
steps {
@majorsilence
majorsilence / Jenkinsfile
Last active February 13, 2022 22:25
Rust Jenkins Pipeline
pipeline {
agent none
stages {
stage('build and test') {
agent {
docker {
image 'rust:1.58.1'
}
}
steps {
@majorsilence
majorsilence / Jenkinsfile
Created February 13, 2022 22:22
Dotnet Jenkins Pipeline
pipeline {
agent none
environment {
DOTNET_CLI_HOME = "/tmp/DOTNET_CLI_HOME"
}
stages {
stage('build and test') {
agent {
docker {
image 'mcr.microsoft.com/dotnet/sdk:6.0'
@majorsilence
majorsilence / curl_kubernetes_keys.sh
Created October 31, 2021 18:38
kubernetes use curl with TLS keys example
export client=$(grep client-cert $HOME/.kube/config | cut -d" " -f 6)
export key=$(grep client-key-data $HOME/.kube/config | cut -d " " -f 6)
export auth=$(grep certificate-authority-data $HOME/.kube/config | cut -d " " -f 6)
cho $client | base64 -d - > ./client.pem
echo $key | base64 -d - > ./client-key.pem
@majorsilence
majorsilence / get_bearer_token.sh
Created October 31, 2021 18:36
kubernetes get bearer token
# kubectl get secrets
# kubectl get endpoints
# kubectl config view
export token=$(kubectl describe secret default-token[THE RANDOM CODE] | grep ^token | cut -f7 -d ' ')
curl https://[IP or host name]:6443/apis --header "Authorization: Bearer $token" -k
@majorsilence
majorsilence / SimpleCache.cs
Last active October 31, 2021 18:38
Simple c# in memory cache. I have no idea if I built this or found it on the web somewhere. I find this interesting.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
namespace MajorSilence
{
public class SimpleCache
{
@majorsilence
majorsilence / powershell_github_basic_auth.ps1
Last active January 19, 2022 21:17
Powershell - Github Api - List Pull Requests - Basic Authentication
# See https://developer.github.com/v3/pulls/#list-pull-requests
$endpoint = "https://api.github.com/repos/[Owner]/[Repo]/pulls?state=[state]"
function Get-BasicAuthCreds {
param([string]$Username,[string]$Password)
$AuthString = "{0}:{1}" -f $Username,$Password
$AuthBytes = [System.Text.Encoding]::Ascii.GetBytes($AuthString)
return [Convert]::ToBase64String($AuthBytes)
}