Skip to content

Instantly share code, notes, and snippets.

@aybabtme
aybabtme / config
Created January 6, 2025 16:06
fast Quake-mode in Ghostty `~/.config/ghostty/config`
keybind = global:option+space=toggle_quick_terminal
quick-terminal-animation-duration=0.07
@aybabtme
aybabtme / Dockerfile
Created November 25, 2024 07:08
dockerfile for self-hosting next.js
FROM node:22-alpine AS base
# deps
FROM base AS deps
WORKDIR /usr/src/app
RUN apk add --no-cache libc6-compat
COPY package.json package-lock.json* ./
RUN npm ci
# builder
@aybabtme
aybabtme / matrix_mul.js
Created November 20, 2013 17:38
Strassen Matrix Multiplication in Javascript
// Scalar stuff
var Scalar = {};
(function () {
"use strict";
Scalar.mulFunc = function (first, second) {
return first * second;
};
import "net/http/httptrace"
func (cl *httpClient) makeTrace(kvs []*kvpb.KV) *httptrace.ClientTrace {
start := cl.timeNow()
var (
startDial = start
startDNS = start
startConnect = start
startTLS = start
@aybabtme
aybabtme / DequeTest.java
Created August 25, 2012 08:10
Test for a properly working Deque - according to Coursera Algorithms Part 1, asg 2.
import java.util.Iterator;
import java.util.NoSuchElementException;
import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
@aybabtme
aybabtme / notes.md
Created February 1, 2022 18:29
wip: workflow orchestration review
@aybabtme
aybabtme / gist:3909791
Created October 18, 2012 03:58
Heroku is messing with me
$ git push heroku master
! Heroku has temporarily disabled this feature, please try again shortly.
! See http://status.heroku.com for current Heroku platform status.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
const magnitudes = [
{magnitude: 1_0000_0000, suffix: "억"},
{magnitude: 1_0000, suffix: "만"},
// {magnitude: 1000, suffix: "천"}, // this works too
];
const krFormat = (num: number): string => {
const m = magnitudes.find((m) => num >= m.magnitude);
if (!m) {
return `${num}`
@aybabtme
aybabtme / update_secret_from_file.sh
Last active November 23, 2020 10:49
Snippet to edit the value of a key in a k8s secret using a file as source for that value.
local namespace=""
local secret=""
local data_key=""
local filename=""
kubectl get secret -n ${namespace} ${secret} -o json \
| jq --arg datakey ${data_key} --argjson value <(base64 -w 0 < ${filename} | jq -R -s '.') '.data[$datakey] = $value' \
| kubectl apply -f -
# Clear the cookies
$ rm cookies.txt
# Create a user
$ curl -v -b cookies.txt -c cookies.txt -X POST 127.0.0.1:8080/api/v0.1/employees -d '{"employeeId":666, "password":"hello"}'
HTTP/1.1 201 Created
# Try querying without auth
$ curl -v -b cookies.txt -c cookies.txt -X GET 127.0.0.1:8080/api/v0.1/employees
HTTP/1.1 401 Unauthorized