Skip to content

Instantly share code, notes, and snippets.

View dacbd's full-sized avatar
💭
Fitting 🟥 into 🟢

Daniel Barnes dacbd

💭
Fitting 🟥 into 🟢
View GitHub Profile
#! /bin/bash
set -eu
# find path to liblzma used by sshd
path="$(ldd $(which sshd) | grep liblzma | grep -o '/[^ ]*')"
# does it even exist?
if [ "$path" == "" ]
then
@dacbd
dacbd / dvc.yaml
Created August 16, 2023 18:01
dvc-pipeline-base
stages:
train:
cmd: python train.py
params:
- params.yaml:
metrics:
- dvclive/metrics.json:
cache: false
plots:
- dvclive/plots:
@dacbd
dacbd / verify-token.sh
Created March 8, 2023 22:18
GitLab Token debugging
GITLAB_API_TOKEN={token} # where {token} is an API token in the form /glpat-.*/
GITLAB_PROJECT_SLUG={user}%2F{project} # where {user} and {project} are placeholders
GITLAB_RUNNERS_TOKEN=$(curl --header "Authorization: Bearer $GITLAB_API_TOKEN" "https://gitlab.com/api/v4/projects/$GITLAB_PROJECT_SLUG" | jq --raw-output .runners_token)
GITLAB_RUNNER_REGISTRATION_TOKEN=$(curl --form token="$GITLAB_RUNNERS_TOKEN" https://gitlab.com/api/v4/runners | jq --raw-output .token)
@dacbd
dacbd / deploy.yml
Last active February 28, 2023 17:44
Actions workflow inherit
name: Deploy
on:
workflow_call:
inputs:
deploy_ref:
required: true
type: string
environment:
required: true
type: string
@dacbd
dacbd / bitbucket-pipeline.yml
Created January 12, 2023 11:07
leo example
pipelines:
default:
- step:
name: deploy-runner
image: iterativeai/cml:0-dvc2-base1
script:
- |
leo_id=$(leo create \
--cloud="aws" \
--region="us-east-1" \
@dacbd
dacbd / test.js
Last active June 7, 2022 19:47
node tf wrapper proto
const { Buffer } = require('buffer');
const apply = async (opts = {}) => {
const { dir = './', json = false } = opts;
return new Promise( (resolve, reject) => {
const stderrCollection = [];
//const tf_proc = require('child_process').spawn('terraform',['apply', '-auto-approve', '-json'], {
//const tf_proc = require('child_process').spawn('terraform',['refresh', '-json'], {
const tf_proc = require('child_process').spawn('terraform',['destroy', '-auto-approve', '-json'], {
@dacbd
dacbd / nvidia-src-setup-apt.sh
Last active June 13, 2022 16:51
Install GPU drivers from src
#!/bin/bash
driver_version="515.48.07"
nvidia_dl_path="https://us.download.nvidia.com/XFree86/Linux-x86_64/"
__temp=$(mktemp -d)
pushd "$__temp" || exit
apt-get update -y
apt-get install -y git build-essential
wget "$nvidia_dl_path$driver_version/NVIDIA-Linux-x86_64-$driver_version.run" -O web-installer
git clone --depth 1 --branch "$driver_version" https://github.com/NVIDIA/open-gpu-kernel-modules.git
@dacbd
dacbd / add_my_keys-cml_startup.sh
Last active December 29, 2022 22:13
Debug CML oneliners
echo 'echo "$(curl https://github.com/'"$GITHUB_ACTOR"'.keys)" >> /home/ubuntu/.ssh/authorized_keys' | base64 -w 0
# or
--cloud-startup-script=$(echo 'echo "$(curl https://github.com/'"$GITHUB_ACTOR"'.keys)" >> /home/ubuntu/.ssh/authorized_keys' | base64 -w 0)
@dacbd
dacbd / *.go
Last active April 28, 2022 20:30
some remote machine debugging
os.WriteFile("/tmp/log.txt", []byte(fmt.Sprintf("%s \n %v \n %w", project, res, err)), os.ModeAppend)
@dacbd
dacbd / playbook.yml
Created March 30, 2022 22:15
Install terraform of server
---
- name: install terraform
hosts: all
become: true
tasks:
- name: Terraform deps
apt:
update_cache: true
state: present
pkg: