Skip to content

Instantly share code, notes, and snippets.

View miguelff's full-sized avatar

Miguel Fernández miguelff

View GitHub Profile
@miguelff
miguelff / latency.markdown
Created November 18, 2019 09:46 — forked from hellerbarde/latency.markdown
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

@miguelff
miguelff / .travis.yml
Created July 21, 2019 16:32 — forked from ryboe/.travis.yml
Example .travis.yml for Golang
# use the latest ubuntu environment (18.04) available on travis
dist: xenial
language: go
# Force-enable Go modules. Also force go to use the code in vendor/
# These will both be unnecessary when Go 1.13 lands.
env:
- GO111MODULE=on
- GOFLAGS='-mod vendor'
@miguelff
miguelff / tee.rb
Last active August 9, 2018 10:18
Just run `ruby tee.rb`
require "set"
@mantras = Set.new
trap "SIGINT" do
puts "YOU HAVEN'T FINISHED YET!"
end
def learn(&instructions)
instance_eval &instructions
@miguelff
miguelff / debugging_c_with_llvm.md
Created May 24, 2018 13:07 — forked from gregmalcolm/debugging_c_with_llvm.md
Debugging C with llvm's clang and lldb

Assuming you llvm installed (comes as standard on Mac OS Mavrick xtools)

Create a helloworld.c file:

  #include<stdio.h>
  
  int main()
  {
 int x=3;

Tips about drawing digitally

I asked on https://www.facebook.com/groups/1014974001864957/permalink/1252338398128515/ and these were the main points:

  • Set the tablet settings, on the driver and on the software used for drawing. For example, pressure sensitivity.
  • Check the projection: what screen you're using to project the table and ensure the "constrain proportions" setting is checked.
  • Consider line stabilizing software like Lazy Nezumi Pro (only Windows so far). Sketchbook Pro has this sort of line as well.
  • Use Mischief rather than Photoshop for line drawing. It's simpler and produces more natural line drawing, which can be later exported for rendering in Photoshop.
  • Get comfortable with using undo constantly.
  • Use hard felt nibs for the tablet, the have increased friction and feel more like a pen on paper.
## Platform-data tooling
This document describes the set of tools and processes used by @github/platform-data to satisfy their operational needs, and accomplish their [goals](https://github.com/github/platform-data#our-goals-and-values) in an effective and efficient way.
#### Operational needs (goals alignment)
What we do defines our needs. Our main goal is to make sure GitHub is resilient and keeps being fast even if there is "a million of them", to do it, we carry on the following activities:
* **Modelling**: Given a new feature, design and implement data models and access patterns that are both fast and scalable.
* **Reviewing:** Given a proposed PR, advise and provide alternatives on maintainability or performance improvements.
@miguelff
miguelff / benchmarks.out
Last active February 6, 2016 17:31
Fibo.rb
user system total real
Iterative (10) 0.000000 0.000000 0.000000 ( 0.000006)
Formula (10) 0.010000 0.000000 0.010000 ( 0.010514)
Recursive (10) 0.000000 0.000000 0.000000 ( 0.000004)
Iterative (20) 0.000000 0.000000 0.000000 ( 0.000004)
Formula (20) 0.040000 0.000000 0.040000 ( 0.043513)
Recursive (20) 0.000000 0.000000 0.000000 ( 0.000010)
Iterative (100) 0.010000 0.000000 0.010000 ( 0.000048)
Formula (100) 1.130000 0.010000 1.140000 ( 1.141393)
Recursive (100) 0.000000 0.000000 0.000000 ( 0.000034)

belongs_to:

  1. Assigning an object to a belongs_to association does not automatically save the object. It does not save the associated object either.

has_one:

  1. When you assign an object to a has_one association, that object is automatically saved (in order to update its foreign key).
  2. In addition, any object being replaced is also automatically saved, because its foreign key will change too
  3. If either of these saves fails due to validation errors, then the assignment statement returns false and the assignment itself is cancelled.
  4. If the parent object (the one declaring the has_one association) is unsaved (that is, new_record? returns true) then the child objects are not saved. They will automatically when the parent object is saved.