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 / Matrix.java
Created April 7, 2012 00:45
In an attempt to see if the Matrix is solvable (http://www.drunkmenworkhere.org/129) and to learn recursion further - Saw the opportunity and shot for it.
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Matrix {
static int[][] matrix = new int[5][5];
static int max = 0;
@lgo
lgo / S1.java
Last active December 15, 2015 03:09
DWITE 4 Round 3 Solutions
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
public class S1
{
public static void main(String[] args) throws Exception {
@lgo
lgo / Sol1.java
Last active December 16, 2015 17:00
ECOO Split Code Decryption Solution
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
public class Sol1 {
@lgo
lgo / Sol4.java
Last active December 16, 2015 17:18
ECOO Cryptarithm Encrypter
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Sol4 {
#!/usr/bin/env python
"""
Provide useful alembic information after switching branches.
"""
import argparse
import subprocess
import os
import os.path
import py.path
@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:

@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 / 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 / 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 / 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