Skip to content

Instantly share code, notes, and snippets.

@pacoguzman
pacoguzman / markdown-callouts.md
Last active August 1, 2023 13:04 — forked from samuelneff/markdown-callouts.md
Markdown callouts don't work
@pacoguzman
pacoguzman / latency.txt
Created May 23, 2023 09:29 — forked from jboner/latency.txt
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
@pacoguzman
pacoguzman / DNI-Electronico-en-Mac.md
Last active January 16, 2023 09:00 — forked from bomberstudios/DNI-Electronico-en-Mac.md
Instrucciones para instalar el DNI Electrónico en un Mac en 2021

DNI Electrónico en Mac

El lector que voy a usar es el SVEON SCT011M, que es el mas barato que encontré en tienda física y tiene un precio razonable en Amazon: https://www.amazon.es/dp/B072LTLZW3/

Estos son los pasos que he seguido:

  1. Descargar Firefox (he probado con la ultima version, 86.0.1)
  2. Enchufar el lector, sin el DNI (no se si es importante hacerlo aquí o se puede hacer luego, pero mejor no nos arriesgamos, yo lo hice aquí y me ha funcionado)
  3. Descargar https://www.dnielectronico.es/descargas/software_MACOS/libpkcs11-dnie-1.6.7_x64.pkg para Intel, o https://www.dnielectronico.es/descargas/software_MACOS/libpkcs11-dnie-1.6.7_arm64.pkg para ARM (estos enlaces estan en la web oficial del DNI Electrónico, https://www.dnielectronico.es/PortalDNIe/PRF1_Cons02.action?pag=REF_1113)
  4. Instalar el paquete (los ficheros se copiaran en /Library/Libpkcs11-dnie, y en esa misma carpeta se instalara una app para desinstalarlo en el futuro cuando algo vaya inevitablemente mal).
@pacoguzman
pacoguzman / elixirphoenix.bash
Created February 16, 2017 10:33 — forked from likethesky/elixirphoenix.bash
Installing Elixir & the Phoenix framework with Homebrew on OS X
$ brew update && brew doctor # Repeat, until you've done *all* the Dr. has ordered!
$ brew install postgresql # You'll need postgres to do this... you may also need to 'initdb' as well. Google it.
$ brew install elixir
$ mix local.hex # Answer y to any Qs
$ createuser -d postgres # create the default 'postgres' user that Chris McCord seems to like -- I don't create mine w/a pw...
# Use the latest Phoenix from here: http://www.phoenixframework.org/docs/installation -- currently this is 1.0.3
# ** Answer y to any Qs **
$ mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v1.0.3/phoenix_new-1.0.3.ez
@pacoguzman
pacoguzman / 0-react-hello-world.md
Created October 11, 2016 09:48 — forked from danawoodman/0-react-hello-world.md
React Hello World Examples

React "Hello World" Examples

Below are a small collection of React examples to get anyone started using React. They progress from simpler to more complex/full featured.

They will hopefully get you over the initial learning curve of the hard parts of React (JSX, props vs. state, lifecycle events, etc).

Usage

You will want to create an index.html file and copy/paste the contents of 1-base.html and then create a scripts.js file and copy/paste the contents of one of the examples into it.

@pacoguzman
pacoguzman / irpf.rb
Created May 26, 2016 11:17 — forked from fxn/irpf.rb
IRPF 2014
# Usage:
#
# ruby irpf.rb tax_base
#
# Example:
#
# ruby irpf.rb 65300
# 65300 €, 22722 €, 34.8%
#
# Where 22,722 € is the IRPF to pay, and 34.8% is the real rate, that is,
@pacoguzman
pacoguzman / gist:716aa625ca5a11ce47fa
Last active August 29, 2015 14:13
Problem-Solving iPad

Problem-Solving Games

My daughter and I love playing problem-solving games together. After completing a few I asked for recommendations on Twitter. Here's the list.

Completed

@pacoguzman
pacoguzman / associations_tests.rb
Created January 18, 2014 07:18
Associations Stuff
unless ENV['AR_VERSION']
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle'
# Public: A module to be mixed in another class with common methods to index
# records in ElasticSearch.
#
# The host object needs to respond to 'indexed_attributes', which will return
# an array of the attributes names to be indexed.
#
# It's also recommended to override the 'save?' method to make sure only
# records that match some specifications are indexed.
#
# The type used for the ElasticSearch index will be extracted from the name of