Skip to content

Instantly share code, notes, and snippets.

View gustavofonseca's full-sized avatar

Gustavo Fonseca gustavofonseca

  • São Paulo, Brazil
View GitHub Profile
@andyrbell
andyrbell / scanner.sh
Last active July 9, 2024 16:43
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@denji
denji / README.md
Last active July 15, 2024 14:43 — forked from Cubixmeister/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@favila
favila / datomic-edn-handlers.clj
Created April 5, 2016 00:24
Utilities for making it easier to read edn files. Also includes tag readers that datomic uses.
(ns favila.read-edn.tag-readers
"Common tag-reader maps for edn."
(:require datomic.db
datomic.function
datomic.codec)
(:import java.net.URI))
(defmethod print-method URI [^URI x ^Writer w]
(doto w
(.write "#uri ")
@jboner
jboner / latency.txt
Last active July 20, 2024 12:55
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@alvesjnr
alvesjnr / MyList.py
Created May 18, 2011 13:17
List wich accept & operator
class MyList(list):
def __and__(self, other):
op = str(bin(other)[2:])
op = op.zfill(len(self))[::-1]
acc = []
for count,i in enumerate(op):
if int(i):
acc.append(self[count])
return acc