Skip to content

Instantly share code, notes, and snippets.

View johnstcn's full-sized avatar
🏳️‍🌈

Cian Johnston johnstcn

🏳️‍🌈
View GitHub Profile
@johnstcn
johnstcn / prom_snapshot.sh
Created October 17, 2024 13:34
Script to snapshot a Prometheus pod and download the snapshot locally
#!/bin/bash
# Ensure that the script exits on any errors
set -euo pipefail
if [[ -n "${VERBOSE:-}" ]]; then
set -x
fi
# Check that the correct number of arguments are provided
2024-02-29T10:05:19.7563508Z Current runner version: '2.312.0'
2024-02-29T10:05:19.7566955Z Runner name: 'buildjet.com_535e1c79-ec10-4804-a0c5-6c7449681dc5'
2024-02-29T10:05:19.7567486Z Runner group name: 'Default'
2024-02-29T10:05:19.7567937Z Machine name: 'ubuntu'
2024-02-29T10:05:19.7569309Z ##[group]GITHUB_TOKEN Permissions
2024-02-29T10:05:19.7570290Z Contents: read
2024-02-29T10:05:19.7570543Z Metadata: read
2024-02-29T10:05:19.7570769Z Packages: write
2024-02-29T10:05:19.7571027Z ##[endgroup]
2024-02-29T10:05:19.7573387Z Secret source: Actions
@johnstcn
johnstcn / tree_tmp_coder.txt
Created September 5, 2023 08:40
tree /tmp/coder
coder-b5fcdc954-8ms2s:~$ tree /tmp/coder
/tmp/coder
├── provisioner-0
│ ├── tf
│ │ └── registry.terraform.io
│ │ ├── coder
│ │ │ └── coder
│ │ │ ├── 0.10.0
│ │ │ │ └── linux_amd64
│ │ │ │ ├── LICENSE
// This is lifted directly from https://github.com/gorilla/websocket/blob/master/examples/echo/server.go
// without the build:ignore directives
// Copyright 2015 The Gorilla WebSocket Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
@johnstcn
johnstcn / foundry-vtt-macro-sfrpg-mass-roll.js
Created May 21, 2022 15:58
Foundry VTT Macro for Starfinder RPG -- Mass Ability, Save, or Skill Roll
/*
* Foundry VTT Macro for Starfinder RPG -- Mass Ability, Save, or Skill Roll
*/
let targetActors = getTargetActors().filter(a => a != null);
function checkForActors(){
if (targetActors.length == 0)
throw new Error('You must designate at least one token as the roll target');
}
checkForActors();
@johnstcn
johnstcn / foundry-vtt-macro-sfrpg-mass-perception.js
Created May 21, 2022 15:54
Foundry VTT Macro for Starfinder RPG -- Mass Perception Check
/*
* Foundry VTT Macro for Starfinder RPG -- Mass Perception Check
*/
// Gets list of selected tokens, or if no tokens are selected then the user's character.
function getTargetActors() {
const character = game.user.character;
const controlled = canvas.tokens.controlled;
let actors = [];
(function() {
game.playlists.filter(p => p.playing).forEach(p => p.playNext());
})()
(function({fadeDuration=5000}={}) {
function fadeOutPlaylist(playlist, fadeDuration) {
if (!playlist.playing) return;
let playingSound = playlist.sounds.filter(s => s.playing).find(_ => true).sound;
if (!!!playingSound) return; // should not happen
let currVol = playingSound.volume;
let globalVol = game.settings.get("core", "globalPlaylistVolume");
if (currVol == 0) return;
playingSound.fade(0, { duration: fadeDuration, from: currVol})
setTimeout(() => playlist.stopAll(), fadeDuration);
@johnstcn
johnstcn / foundry-vtt-macro-crossfade.js
Last active November 10, 2023 21:41
Foundry VTT Macro: Cross-fade Playlists
(function({fadeIn="", fadeDuration=5000}={}) {
function fadeInPlaylist(playlist, fadeDuration) {
playlist.playAll().then(function(p) {
let globalVol = game.settings.get("core", "globalPlaylistVolume");
p.sounds.filter(s => s.playing).find(_ => true)
.sound
.fade(globalVol, { duration: fadeDuration, from: 0});
});
}
@johnstcn
johnstcn / Vagrantfile
Last active April 10, 2021 15:12
provision sumo + veins on ubuntu 20.04
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2004"
config.vm.provision "shell" do |shell|
shell.privileged = false
shell.path = "provision.sh"
end
end