Skip to content

Instantly share code, notes, and snippets.

@squarism
squarism / iterm2.md
Last active May 4, 2024 13:06
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@squarism
squarism / stop_sms_spam_on_ios.md
Last active April 29, 2024 23:03
How to send STOP to SMS spam using iOS automation

Credit to Time Johnsen

⚠️ Please consider that this might not be a good idea. It's up to you. I feel like spammers are going to spam, so, idk.

How to Automatically Reply Stop to SMS Spam

  1. Open Shortcuts
  2. Click the bottom tab Automation at the bottom center. It's not Shortcuts, it's Automation.
  3. Create a new Automation using + at the top. This will open Personal Automation and you'll be looking at a list.
@squarism
squarism / .gitlab-ci.yml
Created May 30, 2023 21:37
Gitlab and Vitest Code Coverage with c8
# stages:
# - whatever
# - test
vitest:
stage: test
script:
# assuming scripts: has "test": "vitest" ...
# run your tests with coverage output
- npm test -- run --coverage
@squarism
squarism / amazon_is_almost.md
Last active April 22, 2024 22:39
Amazon is Almost

Amazon is Almost

AWS is full of almost things. This is a list of surprises across all services. Your job as an engineer is to think critically about trade offs. Amazon is an abstraction on hardware. You reap hardware bliss ignorance but you pay for the abstraction. There is no free lunch. Hardware still exists. Hardware in itself is an abstraction.

With AWS you are renting a hardware abstraction to avoid having to host your own. They do not run the abstractions after this point. You do.

@squarism
squarism / cli_replacements.md
Last active April 8, 2024 16:39
Modern CLI Replacements

There are a few lists already, I thought I'd create another one so we can have a long list of lists someday. 🤠 Ordered by approximately which ones I actually use often.

Modern CLI Replacements

  • zoxide - A smarter cd command. Supports all major shells.
  • mcfly - Fly through your shell history. Great Scott!
  • Procs - A modern replacement for ps written in Rust
  • sd - Intuitive find & replace CLI (sed alternative)
  • dust - A more intuitive version of du in rust
  • hyperfine - A command-line benchmarking tool
@squarism
squarism / aws_secret_gen.go
Last active March 30, 2024 20:09
AWS Secret Generator - Useful with Minio or self hosted services when you need an AWS style secret pair
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"flag"
"fmt"
"math/rand"
"os"
@squarism
squarism / multiline.exs
Last active March 25, 2024 15:27
Multiline Anonymous Functions in Elixir
# Examples of Different Styles and Syntax
# legal / positive case / you can do these stuffs
# ---------------------------------------------------------------------------
# single line, nothing special
Enum.map(0...2, fn i -> IO.puts i end)
"""
0
1
HTTP Verb   Route            Model->method()   Description
-----------------------------------------------------------------------------------------
GET         /posts           posts->index()    display a list of all posts
GET         /posts/new       posts->new()      return an HTML form for creating a new post
POST        /posts           posts->create()   create a new post
GET         /posts/:id       posts->show()     display a specific post
GET         /posts/:id/edit  posts->edit()     return an HTML form for editing a post
PATCH/PUT   /posts/:id       posts->update()   update a specific post
DELETE /posts/:id posts->destroy() delete a specific post
@squarism
squarism / minecraft.init.d
Last active February 6, 2024 03:21
Minecraft Server Startup Script For Ubuntu That Supports Multiple Servers
# Below is a script I use to run my server. Replace RENAME (should be in about 4 places) to
# whatever your world is called. I've used this to run Technic server packs.
# The great thing about this is you can run it with multiple servers
# on the same box using tmux session names.
# Steal this. Don't give me credit. @squarism MIT License
# ------------------------------------------------------------------------------------------
#!/bin/sh
@squarism
squarism / alice_has_a_ball.txt
Last active December 19, 2023 17:40
Demonstrating what a machine learning evaluation is like.
Ground Truth is me, a human, asserted the answer. GPT 4.0 did 10/10 (over ChatGPT voice on the mobile app no less).
This is a really terrible ML eval, it's accuracy only. The more real version of this would be hundreds of questions,
lots of data and lots of work. If you aren't putting the work in then your users are. It's the same as functional
testing except with a new-ish data concept, many things in AI/ML are like this. The data is the foreign part to general
software dev.
Perplexity is https://labs.perplexity.ai/