Skip to content

Instantly share code, notes, and snippets.

View borntyping's full-sized avatar

Sam Clements borntyping

View GitHub Profile
@borntyping
borntyping / .gitlab-ci.yaml
Last active June 21, 2022 11:19 — forked from SamStudio8/.gitlab-ci.nojob.yaml
job with variable profiles
my-job:
parallel:
matrix:
- OWLS: 1
CATS: 0
- OWLS: 0
CATS: 1
script:
- echo OWLS=$OWLS
- echo CATS=$CATS
@borntyping
borntyping / blocksigners.sh
Last active March 29, 2021 12:10 — forked from kyhwana/blocksigners.sh
Block RMS support letter signers
#replace "<PAT TOKEN>" with your github PAT token, tested with "Update ALL user data" PAT token.
curl -q https://rms-support-letter.github.io/ | grep "<li>" | grep "github.com" | grep -v "\[" | awk -F "https://github.com/" '{ print $2 }' | awk -F "\"\>" '{ print $1 }' | sed 's/\///g' | sed '/^$/d' | xargs -I USER curl -i -X PUT -H "Authorization: token <PAT token>" -H "Accept: application/vnd.github.v3+json" https://api.github.com/user/blocks/USER
@borntyping
borntyping / kubernetes-api-resources.sh
Created October 21, 2019 09:19
List all Kubernetes resources and subresources
#!/usr/bin/env bash
set -e
function core_resources() {
http "http://127.0.0.1:8001/api/v1" | jq -r '.resources[].name'
}
function group_versions() {
http GET "http://127.0.0.1:8001/apis" | jq -r '.groups[].preferredVersion.groupVersion'
import yaml
import pathlib
print(yaml.load(pathlib.Path("apply.yaml").read_text()))

Jetbrains Keymap

Key Action
Ctrl-W Close tab
Ctrl-B Declaration or usages
Ctrl-D Add selection for next occurrence
F2 Rename
F5 Run
class Chain:
def __init__(self):
self.functions = []
def and_then(self, func):
self.functions.append(func)
return self
def __call__(self, value):
result = value
import path
import json
import attr
import cattr
@attr.s()
class Config:
foo: int = attr.ib()
bar: str = attr.ib()
def main(ctx: click.Context, dev: bool, next: bool):
config_file = 'odyssey.json'
log_file = 'odyssey.log'
if next:
config_file = 'odyssey-next.json'
log_file = 'odyssey-next.log'
if not dev:
config_file = os.path.join('/etc/gb/marrs/', config_file)
class TimePeriod
attr_accessor :seconds
def hours
seconds / 3600
end
def hours=(value)
seconds = value * 3600
hours
module ExampleModule
def hello
puts 'hello world'
end
end
class ExampleClass
include ExampleModule
end