Skip to content

Instantly share code, notes, and snippets.

View aelesbao's full-sized avatar
👾
Flying

Augusto Elesbão aelesbao

👾
Flying
View GitHub Profile
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active April 26, 2024 04:52
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@timvw
timvw / RemoteIteratorWrapper.scala
Created July 17, 2016 19:24
scala wrapper for hadoop remote iterator
case class RemoteIteratorWrapper[T](underlying: org.apache.hadoop.fs.RemoteIterator[T]) extends scala.collection.AbstractIterator[T] with scala.collection.Iterator[T] {
def hasNext = underlying.hasNext
def next() = underlying.next()
}
object Conversions {
implicit def remoteIterator2ScalaIterator[T](underlying: org.apache.hadoop.fs.RemoteIterator[T]) : scala.collection.Iterator[T] = RemoteIteratorWrapper[T](underlying)
}
@Mic92
Mic92 / pacman
Last active December 27, 2015 02:09
Etckeeper Wrapper for pacman and yaourt
#!/bin/bash
if [[ "$1" != -S && "$1" != -S*u && "$1" != -U ]]; then
/usr/bin/pacman "$@"
exit $?
fi
[[ $EUID -eq 0 ]] && etckeeper pre-install
/usr/bin/pacman "$@"
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs