Skip to content

Instantly share code, notes, and snippets.

View sbilello's full-sized avatar

Sergio Bilello sbilello

View GitHub Profile
@sbilello
sbilello / install_pyenv_mac_zsh.rst
Created April 20, 2022 21:48 — forked from josemarimanio/install_pyenv_mac_zsh.rst
Installing pyenv on macOS for Zsh using Homebrew
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Stream;
@sbilello
sbilello / clean_code.md
Created August 22, 2020 17:02 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@sbilello
sbilello / latency.txt
Created July 10, 2020 18: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
@sbilello
sbilello / ssh-agent-forwarding-screen.md
Created October 29, 2019 19:58 — forked from martijnvermaat/ssh-agent-forwarding-screen.md
SSH agent forwarding and screen

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

#!/usr/bin/env bash
##
# This configures an S3 bucket ObjectCreated notification for the given Lambda
# function so that when a file is uploaded the Lambda function is invoked. This
# is useful when the bucket is not defined in the same CloudFormation template
# as the function. CloudFormation cannot setup the notification in this case.
#
# Note that the AWS CLI is used and will require valid AWS credentials for the
# account containing the resources. The 'jq' JSON processor is also required
@sbilello
sbilello / iterm2-solarized.md
Created February 19, 2019 23:12 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

from readypipe import requests, starting_task, subtask, schedule, save, schedule_many, open_browser
from json import loads
from lxml import etree
import datetime
from pandas import read_csv
from requests.exceptions import ConnectTimeout
SEARCH_URL = 'https://www.fandango.com/%s_movietimes?mode=general&q=%s'
JSON_ENDPOINT = 'https://www.fandango.com/napi/theaterswithshowtimes?zipCode=%s&city=&state=&date=%s&page=1&favTheaterOnly=false&limit=10&isdesktop=true'
@sbilello
sbilello / gist:7d9cfa810195affb8642b9a537816be8
Created August 1, 2018 17:57 — forked from fernandoaleman/gist:5083680
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
@sbilello
sbilello / AccountControllerTest.groovy
Created July 13, 2018 22:06 — forked from jeffsheets/AccountControllerTest.groovy
Spock test with Mocks of Spring MVC Rest Controller using standaloneSetup and mockMvc
import groovy.json.JsonSlurper
import org.springframework.test.web.servlet.MockMvc
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.http.HttpStatus.*
import spock.lang.Specification
/**
* A Spock Spring MVC Rest unit test that doesn't require a full spring context
*/