Skip to content

Instantly share code, notes, and snippets.

@johand
johand / dijkstra.rb
Created April 13, 2019 17:39
Dijkstra’s algorithm in ruby
class Dijkstra
attr_reader :graph, :costs, :parents, :processed
def initialize(graph, costs, parents)
@graph = graph
@costs = costs
@parents = parents
@processed = []
end
@johand
johand / upgrading_pg.md
Last active January 23, 2024 02:12
Upgrading PostgreSQL to a major version in Archlinux

Upgrading PostgreSQL to a major version in Archlinux

# pacman -S postgresql-old-upgrade

# systemctl stop postgresql.service
# mv /var/lib/postgres/data /var/lib/postgres/olddata
@johand
johand / README.md
Created October 5, 2018 06:56
Rails test suite

Rails test suite

Configuration for

  • RSpec
  • shoulda matchers
  • capybara
  • factorybot
  • database_cleaner
  • omniauth-facebook

Colección de alias para GIT

Información para agregar un alias aquí

  • Git log con colores
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit
  • Git log en formato JSON
@johand
johand / mpd.md
Created March 28, 2016 05:01
mpd + ncmpcpp + pulseaudio with systemd in archlinux

Installation

pacman -S mpd ncmpcpp

MPD

copy the example configuration in mpd.conf

# cp /usr/share/doc/mpd/mpdconf.example /etc/mpd.conf
@johand
johand / dependencies.md
Created June 26, 2015 22:12
dependencies for irssi scripts in gentoo
dev-perl/Crypt-OpenSSL-Bignum
virtual/perl-Math-BigInt
dev-perl/class-loader
sci-mathematics/pari
dev-perl/Math-BigInt-GMP
dev-perl/math-pari
dev-perl/crypt-random
dev-perl/crypt-dh
dev-perl/Crypt-Blowfish

Keybase proof

I hereby claim:

  • I am johand on github.
  • I am johand (https://keybase.io/johand) on keybase.
  • I have a public key whose fingerprint is 7AC6 D647 EE90 7337 AB41 2FAC 410E 032B 7EAB 9A85

To claim this, I am signing this object:

@johand
johand / install.sh
Created August 21, 2013 22:51
heroku toolbelt installer without sudo
HEROKU_CLIENT_URL="http://assets.heroku.com.s3.amazonaws.com/heroku-client/heroku-client.tgz"
echo "This script requires superuser access to install software."
echo "You will be prompted for your password."
su -c "sh <<SCRIPT
# download and extract the client tarball
rm -rf /usr/local/heroku
mkdir -p /usr/local/heroku
@johand
johand / saas-course.rb
Created January 27, 2013 10:33
saas course week2-hw1
#hw 1-1: fun with strings
def palindrome?(str)
letters = str.downcase.scan(/\w/)
letters == letters.reverse
end
def count_words(str)
str = str.downcase.split
words = {}
PDF_FLAGS = --fontsize 9.0 \
no-links \
no-toc \
charset iso-8859-1
MD = ../capitulos/00-inicio.md \
../capitulos/01-numeros.md \
../capitulos/02-textos.md \
../capitulos/03-variables.md \
../capitulos/04-conversiones.md \