Skip to content

Instantly share code, notes, and snippets.

View EmmanuelOga's full-sized avatar
🏠
Working from home

Emmanuel Oga EmmanuelOga

🏠
Working from home
View GitHub Profile
@gnat
gnat / postgres_portable_no_install.md
Last active July 22, 2024 09:47
Postgres Standalone

🐘 Postgres Standalone

Why?

  • Localize your database into one single folder of your choosing.
  • No sudo / root requirement.
  • Run multiple Postgres at the same time on the same machine- Full bare metal performance.
  • Postgres is a great starter before moving to "slow single machine but horizontal scale": CockroachDB, ScyllaDB, etc.

Compile

import it.unimi.dsi.fastutil.objects.ObjectAVLTreeSet
data class Quad(val s: String = "", val p: String = "", val o: Comparable<Any>? = null, val c: String = "") :
Comparable<Quad> {
override fun compareTo(other: Quad): Int = compareValuesBy(this, other, Quad::s, Quad::p, Quad::o, Quad::c)
override fun toString(): String = "Q<S=$s P=$p O=$o C=$c>"
}
@mfikes
mfikes / README.md
Last active May 17, 2020 02:37
Seeing the inferred type of a ClojureScript expression

If you are curious about the types inferred by ClojureScript, it is easy to get some insight using a macro:

(defmacro inferred-type [form]
  `'~(cljs.analyzer/infer-tag &env
       (cljs.analyzer/no-warn (cljs.analyzer/analyze &env form))))

This is the kind of dev-time macro you could refer using the new user.cljs feature.

@hgoldstein95
hgoldstein95 / regex-deriv.hs
Created September 30, 2017 17:00
A regular expression matcher using Brzozowski derivatives.
data Regex
= Empty
| Single Char
| Alt Regex
Regex
| Con Regex
Regex
| Star Regex
deriving (Show)

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@vasanthk
vasanthk / System Design.md
Last active November 14, 2024 11:31
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@EmmanuelOga
EmmanuelOga / ObjectSizeFetcher.java
Created December 25, 2014 13:19
Determining java Obj size with java.lang.instrument package. Compile and put this class in a JAR:
// http://stackoverflow.com/questions/52353/in-java-what-is-the-best-way-to-determine-the-size-of-an-object
import java.lang.instrument.Instrumentation;
public class ObjectSizeFetcher {
private static Instrumentation instrumentation;
public static void premain(String args, Instrumentation inst) {
instrumentation = inst;
}
@paf31
paf31 / memo.purs
Created December 16, 2014 01:47
Memoized functions in PureScript
module Main where
import Debug.Trace
import Data.Tuple
import Data.Either
import Data.Lazy
class Memo a where
memo :: forall r. (a -> r) -> a -> Lazy r
@paf31
paf31 / 24days.md
Last active August 8, 2023 05:53
24 Days of PureScript

This blog post series has moved here.

You might also be interested in the 2016 version.