Skip to content

Instantly share code, notes, and snippets.

View rhpaiva's full-sized avatar

Rodrigo Paiva rhpaiva

  • Berlin, Germany
View GitHub Profile
@sleepyfox
sleepyfox / foxs-laws-of-software-development.md
Last active August 2, 2023 16:50
Fox's Laws of Software Development
author: @sleepyfox
title: Fox's laws of software development
date: 27 October 2021
preamble: A not entirely serious treatise on the immutable fundamental laws of software development activities

Fox's laws of software development

A not entirely serious treatise

Local Development Techniques with Kubernetes

This talk is all live demos of tools developers can use in their inner-loop, at development time to be more productive with containers.

Start Easier

Docker Compose captures the build arguments and run arguments so we can focus on our coding.

Various search databases and backends as alternatives to Elasticsearch.

Rust

@rhpaiva
rhpaiva / ApiJsonDeserializationVisitor.php
Last active January 3, 2019 11:39
JMS Serializer Visitor Service that does not perform type casting on deserialization.
<?php
declare(strict_types = 1);
namespace Api\Request;
use Api\Request\Exception\DeserializationException;
use JMS\Serializer\Context;
use JMS\Serializer\Exception\RuntimeException;
use JMS\Serializer\GenericDeserializationVisitor;
@valyala
valyala / README.md
Last active June 3, 2024 17:00
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
@rhpaiva
rhpaiva / setup-new-computer.sh
Last active August 29, 2015 14:21
Steps to setup a new computer for web development based on ubuntu and docker
#!/usr/bin/env bash
# =================================================================
# Steps to setup a new computer for web development based on ubuntu
# =================================================================
# vars
downloads_dir=~/Downloads
chrome_file='google-chrome-stable_current_amd64.deb'
skype_file='skype-ubuntu-precise_4.3.0.37-1_i386.deb'
@rhpaiva
rhpaiva / .bash_aliases
Last active August 29, 2015 14:21
Handful set of aliases
## ================= ##
## Personal aliases ##
## ================= ##
hosts="/etc/hosts"
# shortcuts for bash edition
alias bashreload='source ~/.bashrc'
alias bashedit='vim ~/.bashrc'
@ekayxu
ekayxu / gist:5743138
Created June 9, 2013 10:53
Make Flask support regular expressions in its URL routing
#http://stackoverflow.com/questions/5870188/does-flask-support-regular-expressions-in-its-url-routing
#Even though Armin beat me to the punch with an accepted answer I thought I'd show an abbreviated example of how I implemented a regex matcher in Flask just in case anyone wants a working example of how this could be done.
from flask import Flask
from werkzeug.routing import BaseConverter
app = Flask(__name__)
class RegexConverter(BaseConverter):
def __init__(self, url_map, *items):
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh