Skip to content

Instantly share code, notes, and snippets.

View rubberduck203's full-sized avatar

Christopher McClellan rubberduck203

View GitHub Profile
# Example of how to keep a container running long enough to `exec` into it
# https://stackoverflow.com/a/40605238/3198973
apiVersion: apps/v1
kind: Deployment
metadata:
name: some-deployment
spec:
replicas: 1
selector:
matchLabels:
@rubberduck203
rubberduck203 / spinlock.rs
Last active February 11, 2020 00:41
Spinlock that provides a bare_metal::CriticalSection to bare_metal::Mutex
//! Example implementation of a different way than interrupt::free to provide a critical section.
//!
#![no_main]
#![no_std]
extern crate panic_halt;
use cortex_m::peripheral::syst::SystClkSource;
use cortex_m::Peripherals;
use cortex_m_rt::{entry, exception};
@rubberduck203
rubberduck203 / Delete-MergedBranches.ps1
Created January 3, 2020 17:51
Powershell function for deleting merged git branches
function Delete-MergedBranches() {
Foreach($branch in (git branch --merged master | Select-String ".*master" -NotMatch)) {
git branch -d $branch.ToString().Trim()
}
}
@rubberduck203
rubberduck203 / licenses.ps1
Created April 10, 2019 19:26
Get Nuget license info for project
Get-Package | Select-Object Id,LicenseUrl | Out-File -FilePath .\licenses.txt
Get-Package | Select-Object LicenseUrl | Get-Unique -AsString | Out-File .\unique-licenses.txt
@rubberduck203
rubberduck203 / Timers.ipynb
Last active February 3, 2021 03:22
Sagemath/Jupyter notebook explaining the math for calculating microcontroller timers
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rubberduck203
rubberduck203 / 0_kubernetes_snippets.md
Last active March 28, 2023 13:28
Cordon all Kubernetes Nodes

Some bits and pieces of useful commands for working with k8s

@rubberduck203
rubberduck203 / decrypt.groovy
Created August 8, 2018 01:29
Decrypt Jenkins Secret
// Run in the Jenkins script console
// https://stackoverflow.com/questions/37683143/extract-passphrase-from-jenkins-credentials-xml
// file containing value without surrounding curly braces
File file = new File("/path/to/file.txt")
hudson.util.Secret.decrypt("{${file.text}}")
// file with value including curly braces
File file = new File("/path/to/file.txt")
hudson.util.Secret.decrypt(file.text)
# https://github.com/moby/moby/issues/33794#issuecomment-380969582
docker exec -e COLUMNS="`tput cols`" -e LINES="`tput lines`" -ti ${container_id} bash

Keybase proof

I hereby claim:

  • I am rubberduck203 on github.
  • I am rubberduck (https://keybase.io/rubberduck) on keybase.
  • I have a public key whose fingerprint is 4694 3059 BD59 9381 A0CA 7DC1 0CA0 302F A9DF BEAA

To claim this, I am signing this object:

@rubberduck203
rubberduck203 / keybindings.json
Created May 12, 2018 10:56
VS Code Keybindings for running tests and switching terminal sessions
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "shift+alt+t",
"command": "workbench.action.tasks.test"
},
{
"key":"alt+cmd+[ArrowDown]",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus"