Skip to content

Instantly share code, notes, and snippets.

@jiaaro
jiaaro / docker-compose.yml
Created October 25, 2023 17:14 — forked from mourjo/docker-compose.yml
Docker compose for a minimal Kibana + Elasticsearch locally
version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.1
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- discovery.type=single-node
- bootstrap.memory_lock=true
@jiaaro
jiaaro / main.lua
Created August 14, 2023 21:49
Magic Musicbox v 1.2
--[[
Feature Ideas
- different cycle lengths per instrument
- Setting: "Crank to play", "very slow", "slow", "medium", "fast"
- Setting: set key, scale
- Key: C, C#, etc
- Scale: Major, Minor, Dorian
- change instrument for each track
- 3 drum samples, plus pentatonic scale
- randomize notes
@jiaaro
jiaaro / demonstrate-bloat.sql
Created April 6, 2023 15:56
Bloat lightning talk
-- Setup
drop table bloattable;
create table bloattable (
a int primary key,
b int not null,
x uuid not null,
y uuid not null
);
@jiaaro
jiaaro / process_coinbase_export.py
Last active April 27, 2021 20:02
Coinbase Export: Parse and Process "Convert" Transactions
import csv
csv_path = "/path/to/Coinbase-xxxxx-TransactionsHistoryReport-2021-03-13-22-28-28.csv"
outcsv_path = csv_path + ".processed.csv"
with open(csv_path, "r") as fi, open(outcsv_path, "w") as fo:
r = csv.reader(fi)
w = csv.writer(fo)
for i, row in enumerate(r):
if row and row[-1].startswith("Converted"):
@jiaaro
jiaaro / controller.lua
Last active June 11, 2021 11:18
gamepad emulation of playdate crank
-- uses:
-- https://github.com/rxi/classic
-- https://github.com/rxi/lume
local Object = require 'classic'
local lume = require 'lume'
---@class Controller
local Controller = Object:extend()
local function getStickAngle(x, y)

How to use:

  1. (On a mac) Launch "Script Editor"
  2. Change the language to javascript if needed
  3. Paste the code from wine-launcher.jxa
  4. Save with the file format "Application", and uncheck "Show startup screen" and "Stay open after run handler" (I recommend putting it in your user/Applications directory)
  5. Make sure wine is installed, you can use homebrew
  6. Right click an ".exe" file, choose "Get Info", and then change the "Open with" application to your Wine app that you just made. To make it work for all .exe files, click "Change All…" afterward.

Now you can double click any exe and it'll launch in wine :)

@jiaaro
jiaaro / hexcolor.lua
Last active January 13, 2024 09:35
Hex colors to love2d
-- converts CSS-style hex colors to love2d 0 - 1 scaled colors
-- e.g., hexcolor("ccff99") == {0.8, 1.0, 0.6}
-- supports alpha, e.g., hexcolor("ccff9966") == {0.8, 1.0, 0.6, 0.4}
-- supports shorthand, e.g., hexcolor("cf96") == hexcolor("ccff9966")
-- automatically strips common prefixes, e.g., hexcolor("#cf9"), hexcolor("0xcf9")
local function hexcolor(c)
-- strip leading "#" or "0x" if necessary
if c:sub(1, 1) == "#" then
c = c:sub(2)
elseif c:sub(1,2) == "0x" then
@jiaaro
jiaaro / konami.lua
Last active June 8, 2020 15:07
Love2d Konami Code module
--[[
Example use:
function love.keypressed(key)
konami(key, function()
love.window.showMessageBox("Konami", "the konami code was entered")
end)
end
]]
local MAX_DELAY = 1.5
import asyncio
async def sum_queue_vals(q):
result = 0
while True:
val = await q.get()
if val is None:
break
result += val
return result
@jiaaro
jiaaro / setup_local_codebuild_testing.sh
Last active March 27, 2020 18:44
Set up local testing for codebuild
#!/bin/bash
docker --version
if [[ $? != 0 ]]; then
brew cask install docker
fi
echo "Make sure you have $HOME/bin in your PATH"
mkdir -p ~/bin/
curl https://raw.githubusercontent.com/aws/aws-codebuild-docker-images/master/local_builds/codebuild_build.sh > ~/bin/codebuild_build.sh