Skip to content

Instantly share code, notes, and snippets.

View lgo's full-sized avatar
🚀
Launching to the future

Joey Pereira lgo

🚀
Launching to the future
View GitHub Profile
@lgo
lgo / fabman.rb
Last active October 28, 2023 16:24
Export https://fabman.io/ invoices in a quickbooks-like CSV format
# frozen_string_literal: true
#
# usage:
#
# fabman.rb <AUTH_TOKEN> <OUTPUT_FILE>
#
require 'net/http'
require 'json'
require 'csv'
@lgo
lgo / 0_MORGAN-WEI_IPLG_ROCKET_MARK_152_MANUAL.MD
Last active July 2, 2022 05:07
Morgan-Wei IPLG Simulation Code (https://keri.warr.ca/rockets/) [do not remove: rockets-gist]

Welcome to your computer terminal connected to the network of Morgan-Wei Interplanetary Logistics Group. Please see your submissions for training below. To resume training, visit https://keri.warr.ca/rockets/

@lgo
lgo / aoc_p6.rb
Created December 6, 2020 05:22
advent-of-code 2020, problem 6
# frozen_string_literal: true
def solve(path)
soln_inc = 0
soln_inc_b = 0
lines = File.read(path).split("\n\n")
lines.each do |line|
chars = line.split("\n").map(&:chars).flatten
# Part A
soln_inc += chars.uniq.count
@lgo
lgo / test.rb
Last active August 19, 2019 03:19
Ruby test example for highlight functionality with Sorbet LSP
# typed: true
class TestClass
def method(a, b, &block)
c = a + b
d = c + 3
block.call
foo
@lgo
lgo / test.ts
Last active August 19, 2019 03:22
VSCode typescript LSP highlight functionality. You can observe the behaviour by dropping this into a `.ts` file in VSCode and moving the cursor.
// literal string: only contents, read-references for all exact strings in the file.
function literalString(person) {
return "string";
}
"string";
"string";
"string abc";
// literal numbers: nothing
@lgo
lgo / test.ts
Created August 19, 2019 02:52
VSCode typescript LSP highlight functionality. You can observe the behaviour by dropping this into a `.ts` file in VSCode and moving the cursor.
// literal string: only contents, read-references for all exact strings in the file.
function literalString(person) {
return "string";
}
"string";
"string";
"string abc";
// literal numbers: nothing
@lgo
lgo / play.cr
Last active April 1, 2018 21:23
An unclear compiler error when using case `.meth` notation for tuples passed as variables.
case {1, "hi"}
when {1, .empty?} then "OK"
end
t = {1, "hi"}
case t
when {1, "h"} then "OK"
end
case t # causes "unterminated tuple literal" on the line below
@lgo
lgo / benchmark.go
Created December 16, 2017 06:43
cockroachdb drop table performance benchmarking
package main
import (
"database/sql"
"log"
"time"
_ "github.com/lib/pq"
)
@lgo
lgo / redis-leases
Last active October 16, 2023 14:54
Redis lease implementation
# Redis lease pseudo-code
FUNCTION INIT_LEASES(lock_key, amt)
FOR i := 0; i < amt; i++ DO
LPUSH(lock_key, 0)
END
END
FUNCTION ACQUIRE_LEASE(lock_key)
@lgo
lgo / keybase.md
Last active August 23, 2018 01:22

Keybase proof

I hereby claim:

  • I am lgo on github.
  • I am xlegoz (https://keybase.io/xlegoz) on keybase.
  • I have a public key ASCxXa_qKMdSgjCBS-yMUxezx9auonu320_y7e2-bRtxRgo

To claim this, I am signing this object: