Skip to content

Instantly share code, notes, and snippets.

View clebio's full-sized avatar
💭
I'm in that weird part of Github again.

Caleb Hyde clebio

💭
I'm in that weird part of Github again.
  • Portland, OR
View GitHub Profile
@clebio
clebio / iterm-color-ctx.sh
Last active February 16, 2023 22:10
Set iTerm2 profile based on Kube context in ZSH
# Adapted from https://medium.com/rahasak/change-terminal-color-when-ssh-e2a13ccee681
# Caleb Hyde, 2023-02-15
# REQUIRED: You will need to create a new "Prod" profile in iterm2, and change the color theme on that profile.
# tabc <profile name> do the profile change
# Refer to https://iterm2colorschemes.com/ for lots of suggestions
function tabc() {
NAME="$@"; if [ -z "$NAME" ]; then NAME="Default"; fi
echo -n -e "\033]50;SetProfile=$NAME\a"
}
@clebio
clebio / CollapsedTOC.md
Last active January 26, 2021 20:12
Example of Collapsed table of contents
@clebio
clebio / run.py
Last active November 15, 2020 19:21
Pybullet permute ground plane
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Caleb Hyde
@date: November, 2020
"""
import numpy as np
import pybullet as pb
import pybullet_data
@clebio
clebio / run_async_workers.py
Last active October 21, 2020 20:18
Better Asyncio examples
import asyncio
import random
import time
WORKERS = 3
QUEUE_DEPTH = 5
async def worker(name, queue):
results = []
#!/usr/bin/env python
from time import time, sleep
import curses
from curses import wrapper
from curses.textpad import Textbox, rectangle
from math import sin, cos
def main(stdscr):
@clebio
clebio / System service on Raspberry Pi Buster
Last active December 6, 2019 22:41
System service on Raspberry Pi Buster
Why are gists named after the first file and not the description field above??
# README.md
```
sudo sh -c {
cp oled-system.service /etc/systemd/system/oled-system.service
cp oled_system.py /usr/local/bin/oled-system.py
systemctl daemon-reload
systemctl enable oled-system
}
@clebio
clebio / aws_spot_windows_gpu.tf
Last active February 18, 2019 00:59
Spot Gaming rig on AWS
data "aws_ami" "windows" {
most_recent = true
name_regex = "Windows_Server-2019-English-Full-Base*"
owners = ["amazon"]
}
variable "windows_instance_type" {
default = "g3s.xlarge"
}
@clebio
clebio / initial_setup.sh
Last active June 17, 2018 17:32
Mycroft with Google AIY Voicekit provisioning
cat >> ~/.ssh/config <<EOF
Host mycroft
User pi
Hostname <mycroft's IP>
EOF
ssh mycroft "mkdir ~/.ssh && chmod 700 ~/.ssh"
ssh mycroft "cat >> ~/.ssh/authorized_keys " < ~/.ssh/id_rsa.pub
@clebio
clebio / TigerbytesSwitchesAndLights_sinkingLEDs.ino
Created September 18, 2017 21:07
TigerBytes Arduino example
/*
Based on stock "DigitalReadSerial"
Reads a digital input on several pins, prints the result to the serial monitor, turns on corresponding LED
*/
//Name all the pins that the pushbuttons are on
int pushButton1 = 2;
int pushButton2 = 3;
int pushButton3 = 4;
@clebio
clebio / get_asset_from_s3.py
Created March 3, 2016 19:26
S3 using IAM roles for EC2
#!/usr/bin/env python
from boto import connect_s3
import argparse
parser = argparse.ArgumentParser(description="Read file names and S3 bucket path")
parser.add_argument('bucket_name', type=str, help='Name of the S3 bucket to connect to.')
parser.add_argument('file_path', type=str, help='path to a file on S3')
args = parser.parse_args()