Skip to content

Instantly share code, notes, and snippets.

@progrium
progrium / client.go
Last active August 25, 2021 15:58
simple qtalk rpc example client
// client.go
package main
import (
"context"
"log"
"github.com/progrium/qtalk-go/codec"
"github.com/progrium/qtalk-go/fn"
"github.com/progrium/qtalk-go/talk"
package main
import (
"fmt"
"github.com/.../fds"
"github.com/.../fds/dict"
"github.com/.../fds/list"
"github.com/.../fds/tree"
)
@progrium
progrium / README.md
Last active July 19, 2025 19:41
Setting up M1 Macs for x86 development with Homebrew

Key Points

  • In general, binaries built just for x86 architecture will automatically be run in x86 mode
  • You can force apps in Rosetta 2 / x86 mode by right-clicking app, click Get Info, check "Open using Rosetta"
  • You can force command-line apps by prefixing with arch -x86_64, for example arch -x86_64 go
  • Running a shell in this mode means you don't have to prefix commands: arch -x86_64 zsh then go or whatever
  • Don't just immediately install Homebrew as usual. It should most likely be installed in x86 mode.

Homebrew

Not all toolchains and libraries properly support M1 arm64 chips just yet. Although

@progrium
progrium / README.md
Last active October 17, 2021 18:33
Large Type CLI utility for Mac in less than 80 lines of Go

largetype

largetype screenshot

Building

Note: For now, Apple Silicon users need to be set up for x86 mode

First, download Go or brew install go. Then, put largetype.go in a directory called largetype and from there run:

$ go mod init largetype
@progrium
progrium / html.ts
Last active December 10, 2020 05:23
function ItemList(items: Item[]) {
return html`
<div class="flex flex-row">
<for each=${items} do=${(item) => html`
<if cond=${item.enabled} then=${() => html`
<div class="text-white mx-2">${item.label}</div>
`}>
`} else=${() => html`
<div class="text-gray font-bold">No items</div>
`}>
package main
import (
"fmt"
"log"
"net"
"net/http"
"os"
"os/user"
"path/filepath"
@progrium
progrium / devrc.sh
Created May 28, 2020 19:56
zsh hook to automatically source/"unsource" directories with .devrc
autoload -U add-zsh-hook
load-devrc() {
if [[ -f .devrc && -r .devrc ]]; then
source .devrc
else
if typeset -f devrc-unset > /dev/null; then
devrc-unset
unset -f devrc-unset
fi
fi
sudo softwareupdate --fetch-full-installer
/Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/startosinstall \
--eraseinstall --agreetolicense --nointeraction
package main
import (
"fmt"
"reflect"
)
type MyInterface interface {
Foo() string
}
#!/usr/bin/env osascript -l JavaScript
ObjC.import("Cocoa");
function run(argv) {
var app = $.NSApplication.sharedApplication;
var statusBarItem = $.NSStatusBar.systemStatusBar.statusItemWithLength($.NSVariableStatusItemLength);
var track = Application('Spotify').currentTrack
ObjC.registerSubclass({
name: "ProgramDelegate",