Skip to content

Instantly share code, notes, and snippets.

View mattpetters's full-sized avatar

matt petters mattpetters

  • San Diego
  • 16:57 (UTC -08:00)
View GitHub Profile
@mattpetters
mattpetters / dsa.go
Last active November 1, 2024 14:57
Quick reference implementations of Go data structures and algos for interviews
// Queue
// using a slice
package main
import (
"container/heap"
"fmt"
"math"
)
@mattpetters
mattpetters / rust-flake.nix
Last active September 20, 2024 03:51
Nix development flake for Rust (WIP)
{
description = "Rust development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
-- Kaolin Breeze Neovim Colorscheme
local M = {}
-- Color Palette
local colors = {
bg0 = "#F6F2EF",
bg1 = "#EBE8E4",
bg2 = "#DEDAD5",
bg3 = "#D2CECA",
@mattpetters
mattpetters / pyenv+poetry.sh
Created August 12, 2024 21:17
I always forget how to setup pyenv and poetry so this is the basics
# install pyenv and poetry
brew update
brew install pyenv
pyenv --version
# pyenv 2.3.15
pyenv install 3.10.7
# Wait for a bit for install to finish...
pyenv shell 3.10.7
@mattpetters
mattpetters / rename_stems.sh
Created November 6, 2023 06:56
Script to remove prefixes from Ableton stem exports -- usage: ./rename_stems.sh "MY_PROJECT PREFIX ABCDEF"
#!/bin/zsh
# Check if an argument was provided
if [ $# -eq 0 ]; then
echo "Usage: $0 prefix"
exit 1
fi
# Prefix to be removed (first argument)
PREFIX="$1"
#!/bin/bash
# Get information about all installed applications
system_profiler SPApplicationsDataType
exit 0
#!/bin/bash
# Define the directories
dirs=(
"/Library/Audio/Plug-Ins/Components"
"/Library/Audio/Plug-Ins/VST"
"/Library/Audio/Plug-Ins/VST3"
)
# Loop through the directories
#!/bin/bash
# Check if the input file is provided
if [ -z "$1" ]; then
echo "Usage: $0 <file>"
exit 1
fi
# Store the input file's path
input_file="$1"

How to Patch Envy Code R with Nerd Font Glyphs

The author @damieng did an amazing job with this font but expressly explains that it cannot be redistributed.

So in honoring that here is a little guide for bringing it into the new decade and patching it with Nerd Fonts.

https://github.com/ryanoasis/nerd-fonts#font-patcher

  1. Download the original:
@mattpetters
mattpetters / ConnectionType.ts
Last active December 5, 2022 07:28
TypeORM + TypeScript + Dataloader + Relay Spec (connections, pagination)
import { Connection, Edge } from 'graphql-relay'
import { ClassType, Field, ObjectType } from 'type-graphql'
import { PageInfo } from '../PageInfo'
export function ConnectionType<V>(EdgeType: ClassType<V>) {
// `isAbstract` decorator option is mandatory to prevent registering in schema
@ObjectType({ isAbstract: true, description: 'A connection to a list of items.'})
abstract class ConnectionClass implements Connection<V>{
// here we use the runtime argument