Skip to content

Instantly share code, notes, and snippets.

View FerPerales's full-sized avatar
🎯
Focusing

Fernando Perales FerPerales

🎯
Focusing
View GitHub Profile
@FerPerales
FerPerales / fib.rb
Created July 17, 2022 02:31
fib.rb
# frozen_string_literal: true
# Calcula el n-ésimo número de la sucesión de Fibonacci
# Para correr desde la terminarl:
# ruby fib.rb argumento
# Donde argumento es el número de la sucesión a calcular
# Si el programa corre sin argumentos, calculará el número un millóon de la sucesión
# ruby fib.rb
number = ARGV[0]&.to_i || 1_000_000
@FerPerales
FerPerales / pihole_run.sh
Created August 13, 2020 14:16 — forked from PiotrKrzyzek/pihole_run.sh
Config and run pihole in Docker on MacOS
#!/bin/bash
# I've set this up to use my static IP, instead of dynamically getting one.
# Why? Because if my IP keeps changing, then how is the router supposed to constantly find it?!
# I set a static IP for this computer, and that is that.
IP="YOUR local static IP here"
# Default of directory you run this from, update to where ever.
DOCKER_CONFIGS="~/.pihole"
call plug#begin('~/.vim/plugged')
" Git plugins
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'airblade/vim-gitgutter'
" Search files
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'ctrlpvim/ctrlp.vim'
@FerPerales
FerPerales / asciiputsonglasses
Created July 5, 2019 16:00 — forked from staringispolite/asciiputsonglasses
Ascii art sunglasses meme
Puts on glasses:
(•_•)
( •_•)>⌐■-■
(⌐■_■)
Takes off glasses ("mother of god..."):
(⌐■_■)
( •_•)>⌐■-■
@FerPerales
FerPerales / gist:7276d3c6425e725ed91106094c9737aa
Created April 23, 2019 17:27 — forked from arwagner/gist:1323952
Combinatorial explosion and testing
I found http://groups.google.com/group/growing-object-oriented-software/browse_thread/thread/47695af2c6b5adda fascinating, so I decided to make it a little more concrete. It's also in ruby using rspec, sorry about that. Here's the code under test:
class EligibleForDiscountPolicy
def initialize transaction, user
@transaction = transaction
@user = user
end
def decide
return true if @user.is_gold_member?
rails generate devise:install
@FerPerales
FerPerales / delete-evicted-pods-all-namespaces.sh
Created October 22, 2018 16:38 — forked from psxvoid/delete-evicted-pods-all-namespaces.sh
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

https://www.googleapis.com/youtube/v3/search?type=video&q={BUSQUEDA}&maxResults=25&part=snippet&key={API_KEY}
@FerPerales
FerPerales / .vimrc
Last active February 28, 2018 01:15
" Set max chars in column
set colorcolumn=110
" Colorize extra whitespaces at the end of a line
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
" Auto delete whitespaces on save