openai whisper
Lets use some ai magic to transcribe audio in the command line. simple enough with whisper https://github.com/openai/whisper whisper audiofile.m4a --language English --model medium and then there is the python version which is oktoo import whisper model = whisper.load_model("base") result = model.transcribe("audio.mp3") print(result["text"]) I have had pretty good results with it but i think that i like the ui better for a simple macos app called whisper transcription. there is a paid tier but the free one is good enough for me....
ecr and aws orgs
We have an AWS ORG, we want to share some things between accounts in the ORG. Namely ecr and code artifact. In order to get an ECR repository to share, be shared across multiple AWS accounts, you have many, many, many different ways that you can do this. You can do it probably 12 different ways, and maybe even more than that. But I am going to do it with AWS orgs and with kind of a permissive structure in that anyone that is a part of the org will get access to the ECR....
writing again?
I have been thinking that I should start writing again. Over the past few years I have gone back and forth on the writing and finding both the time and the inspiration to begin writing again. Why have I not been writing enough? Part of it is I have not had the creative energy, and I have not had the inspiration, or I have not been remembering to do it. Also, I’ve not been writing down things I’m learning, and it’s frustrating because I cannot remember what things are, and in order to solve that, I simply need to write things down and start writing again....
zmk dongles
I am trying to create a dongle setup to use with my wireless skeltyls. I have not been using them as much as i would like because they are a giant pita to deal with when they come out of sleep, and when they are reconnecting. so i thought that i would like to try and do a dongle mode with them and see how it goes. Working with ZMK dongles mode in ZMK I have a ZMK keyboard....
makefile list
Working with make commands can be tiresome. Especially when those makefiles are really long and you do not know what commands are in them or you cannot remember what the commands are named. Here is a neat little trick to help with that. make list <Makefile> test: echo "testing" build: echo "building" deploy: echo "deploying" list: @grep '^[^#[:space:]].*:' Makefile | sort just add the extra list command to a makefile like this...
tracing redirects
Follow the redirect road Sometimes you want to have a curl command that traces the redirects and lets you see hops that it makes along the way long story short do this curl -sLD - http://test.chrislatta.org/myredirect.html -o /dev/null it will look like this $ curl -sLD - http://test.chrislatta.org/myredirect.html -o /dev/null HTTP/1.1 301 Moved Permanently Content-Type: text/html; charset=iso-8859-1 Content-Length: 244 Connection: keep-alive Location: http://test.chrislatta.org/hop1.html HTTP/1.1 301 Moved Permanently Content-Type: text/html; charset=iso-8859-1 Content-Length: 244 Connection: keep-alive Location: http://test....
keyboard-mounts
keyboard mounts this is the easiest cleanest and cheapest way I have found to mount a split keyboard. the sticker that you apply to the keyboard case has adhesive and can be bought in a multi pack these are great because they are pretty cheap and their height is less that your standard silicon bumpon, therefore you can have the bumpons for feet and they will sit nicely on any flat surface when not mounted...
tfstate-migration
It turns out that if you were using terraform.io as a remote state only situation, hashicorp is upping the price to a price per resource model and making things really expensive. It is now time to migrate from tf.io to s3 and not pay a ton of money.. BLADE And never again have to pay for a service that would be dirt cheap... RAZOR ...IF it weren't run by a bunch of profiteering gluttons!...
2023-08-24-minimodem
adeventures in old technology so there is an application called minimodem and it will transmit and receive data at various bps etc. why not see what it takes to move a 1.5mb file. cause lol base64 -i img.jpg|minimodem --tx 9600 --ascii -f 9600.wav ffmpeg -i 9600.wav 9600.mp3 ffmpeg -i 9600.mp3 9600.wav minimodem --rx 9600 -f 9600.wav|base64 -d >img_output9600.png at 9600 bps the file is 36 minutes long. and 120mb once in mp3 its 17mb....
terraform targeting
terraform targeting https://github.com/ridingintraffic/ridingintraffic.github.com/wiki/code_sre#terraform-targetingd Yes you are supposed to never use a targeted plan and apply in terraform becuase it is the violation of the Infra as code creed. But you know what sometimes you just gotta do a thing and get it done. Then you never want to remember your shame and as a result you go and forget how to do that thing. so here it is terraform plan -target="aws_appautoscaling_scheduled_action....
gitlab exit codes aws arm building
gitlab and exit codes Sometimes gitlab will have a command or a script that runs and it will not trap an exit code properly. This results in an error condition happening in a script, but the job in the pipeline to come back green. here is some meat and context around the issue as well. https://gitlab.com/gitlab-org/gitlab-runner/-/issues/25394 and then a bit more here https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77601 and then of course it still isn’t fixed as of today’s writing https://gitlab....
boost audio on video file
Was the audio too quiet on something that you recorded? Are you lazy and you don’t want to drop in the file to a timeline editor just so you can gain boost? most laptops will have ffmpeg on them, and if your mac doesnt then a simple brew install ffmpeg https://formulae.brew.sh/formula/ffmpeg ffmpeg -i "your_input_file.mp4" -vcodec copy -filter:a "volume=15dB" "your_output_file.mp4" there you have it short and simple now your video file is louder....
improvisation as a way of life
I am a leaf on the wind, watch how I soar. this is an old post from 2018 that I never added here but I thought it was still relevant today - Roll with the punches, go with the flow, make it up as you go… People always say that you should stay flexible with your plans. Don’t be afraid to change things. Never in my wildest dreams would I fully understand what it means to live a life of constant improvisation than when we had our first child....
python base64 requests jq and terraform
base64 user auth in requests use the base64 for the first header and then reuse the bearer token that you get back. import requests import json from requests.auth import HTTPBasicAuth headers = { 'Content-Type': 'application/json', 'Accept': 'application/json' } base_url = 'https://www.something.com' token_url = "/tauth/1.0/token/" url=base_url + token_url response = requests.post(url, headers=headers, auth=HTTPBasicAuth(USER, PASSWORD)) data = response.json() #reusing that bearer token from the repsonse headers = { 'Authorization': f"Bearer {data['token']}", 'Content-Type': 'application/json', 'Accept': 'application/json' } url="/something/" response=requests....
python nested dictionary access
Getting dictionaries back from a http endpoint usually results in a mess of objects. Dealing with this in python can be a challenge of ValueError exceptions. so what is the easiest way to handle this? a nested get. if the object looks like message={"detail":{"operation":"create"}} then you can access it like this message.get('detail', {}).get('operation') then if you access something that doesn’t exist you will get a nice None back >>> print(message.get('detail', {})....
git single file
Sometimes you just need a single file from a git repo. I know that this is not the typical way we use git, but sometimes you just need to do a thing. So I want a single file, how do i do that? git archive --format=tar --remote=ssh://git@github.com:someuser/somefile.git{main} -- my_file_name |tar xf - and like that you can snag one file from one repo and get on with your life.
terraform depends without depends_on
Terraform depends pattern without depends_on. Or how to use hcl to leverage its interal dependancy handling, to to hard things for you. We are going to use an example of an aws sqs queue, dlq, and queue policy all strung together. The issue that I ran in to was I wanted to create all of these using a single list of words as my seed values. Then the issue arose around using a for_each with a dynamic resource group when terraform would need group 1 to be appied before it knew what to setup for group 2....
macos text entering weirdness
Just another basic reminder for a thing that I fixed with my laptop when it was acting odd and weird; I was working on my mac and I kept encouring a weird behavior where certain keys that were held down would not repeat, but would pop up a prompt on my screen to enter some kind of special accented internantionl character. In macOS, when a key is held down while entering text, a popup is shown which lets one choose between various accented forms of the character....
wireless zmk mac sleep waking bug
bug in zmk fancy keyboards use a controller called a nice nano, that nice nano runs a firmware called zmk. That firmware has a fair few options to configure a few things. One of the nice options is deep sleep, which powers things down to save battery on the board when not in use. Many people argue that this feature eliminates the need for a physical battery switch. However there is a bug with mac that is/was waking up the mac from sleep eventhough the “keyboard is alseep” You can fix it with....
fun with cloudwatch logs
writing directly to cloudwatch logs sometimes you just need to write to a cloudwatch log and you want to do that from the terminal? You can do this with jq bash and aws cli yey timestamp=$(date +%s000); \ json_data=$(jq --null-input --arg timestamp $timestamp '{"timestamp": ($timestamp|tonumber), "message": "ssn: 123-12-1234"}'); \ aws logs put-log-events --log-group-name /dev/ridigintraffic --log-stream-name something-special --log-events "$json_data"