Skip to content

Instantly share code, notes, and snippets.

View plentz's full-sized avatar

Diego Plentz plentz

View GitHub Profile
@plentz
plentz / air_quality.md
Last active November 26, 2023 22:15
air quality

I’ve been obsessing interested in air quality for the last 2 months (pretty much because I saw that famous DHH talk and the Awair Element gamify it - but I highly recommend it to check if the changes you’re making are actually working). Here are a few things to consider:

  • I recommend getting a ultrasonic one just because the maintenance is just way easier. And your should REALLY think about maintenance (you don't want a filter you need to change filters every month and have a hard time cleaning it). The ones I recommend are:
    • Levoit ultrasonic 300S: huge 6L tank, good for bedrooms and smaller rooms, super easy to fill and clean. Works with Alexa and Google.
  • Levoit ultrasonic LV600S: huge 6L tank, generates a lot of umidity, ideal for bigger rooms, dece

TFSA

dinheiro pos-tax mas com rendimento tax-free. tem limite anual de 6000 em deposito (desde que tu se mudou pro canada - no wealth simple tem um wizard que calcula pra ti). tu pode sacar o dinheiro e o limite volta de novo no ano seguinte. Se tu não usar, o limite continua aumentando. ex, se passar 3 anos sem colocar dinheiro, pode colocar 18k no 3o ano. se sacar 5k, no ano seguinte vai poder depositar 11k (6K do limite novo + 5k do saque). Quando saca não paga imposto at all. bem no-brainer colocar dinheiro no TFSA e maximizar o quanto antes.

RRSP

pode colocar 18% do rendimento do ano anterior, até o limite de 27230 (em 2020, isso varia ano a ano). o dinheiro que é colocado lá é tax free, bem como o rendimento. o que quer dizer que o que tu colocar lá, recebe o imposto pago pelo dinheiro no imposto de renda do ano seguinte. Cenario: colocou 10k no RRSP, com renda de 100k / ano. no ano seguinte quando declarar imposto é como se tua renda tivesse side de 90k pra fims de imposto e o imposto pago nos

@plentz
plentz / podcasts.md
Last active August 6, 2020 18:17
podcasts
  • hipsters.tech
  • like a boss
  • gimlet startup podcasts (recomendação do pcalcado)
  • masters of scale (recomendação do pcalcado)
  • revisionist history (recomendação do bzanchet)
  • dtr (podcast do tinder)
  • we are netflix

parei de ouvir:

  • 99% invisible
@plentz
plentz / ladder.md
Created October 28, 2015 15:50 — forked from jamtur01/ladder.md
Kickstarter Engineering Ladder
#!/bin/sh
# creating security groups
ec2-create-group 'AWS-OpsWorks-Web-Server' -d 'AWS OpsWorks Web server - do not change or delete'
ec2-create-group 'AWS-OpsWorks-Default-Server' -d 'AWS OpsWorks Default server - do not change or delete'
ec2-create-group 'AWS-OpsWorks-Blank-Server' -d 'AWS OpsWorks blank server - do not change or delete'
ec2-create-group 'AWS-OpsWorks-LB-Server' -d 'AWS OpsWorks load balancer - do not change or delete'
ec2-create-group 'AWS-OpsWorks-PHP-App-Server' -d 'AWS OpsWorks PHP-App server - do not change or delete'
ec2-create-group 'AWS-OpsWorks-DB-Master-Server' -d 'AWS OpsWorks database master server - do not change or delete'
ec2-create-group 'AWS-OpsWorks-Memcached-Server' -d 'AWS OpsWorks Memcached server - do not change or delete'
ec2-create-group 'AWS-OpsWorks-Monitoring-Master-Server' -d 'AWS OpsWorks Monitoring Ganglia server - do not change or delete'
include_recipe "logrotate"
logrotate_app "tomcat" do
cookbook "logrotate"
path "/var/log/tomcat/catalina.out"
options ["copytruncate", "missingok", "notifempty"]
frequency "daily"
rotate 3
create "644 tomcat tomcat"
size "50M"

Session Management in an Autoscaling Environment

Problem Statement

User sessions in J2EE and LAMP stacks have traditionally been handled in memory by the application server handling the user request. Because of that, load balancers have been configured to use sticky sessions. By sticky sessions we mean that once the user has visited the site, they will be assigned an app server and will return to that server for subsequent requests. The load balancers typically handle that by referencing the users session cookie.

Elastic cloud environments differ from traditional server configurations in that they have a variable number of servers based on traffic loads whereas traditional configurations had a fixed number of servers. When traffic volumes decline it is necessary to vaporize servers. In doing so, we would lose user sessions (essentially forcing a logout) unless we come up with a new strategy for session management.

A new approach

After much research, it is clear that the best

@plentz
plentz / nginx.conf
Last active November 14, 2024 08:35
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@plentz
plentz / gist:5630854
Created May 22, 2013 20:59
gdb output of segfault while running sidekiq @ ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
This file has been truncated, but you can view the full file.
...
[Thread 0x2aaad4201940 (LWP 11770) exited]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaac6464940 (LWP 11237)]
vm_exec_core (th=0x83ba000, initial=0) at vm_exec.c:35
35 {
(gdb) t a a bt
Thread 138 (Thread 0x2aaad4302940 (LWP 11624)):
+ jruby -S -Xdebug.loadService.timing=true rake db:migrate db:test:prepare
2012-12-13T14:07:09.652-02:00: LoadService: -> jruby
2012-12-13T14:07:09.727-02:00: LoadService: -> java
2012-12-13T14:07:09.812-02:00: LoadService: -> jruby/java
2012-12-13T14:07:09.935-02:00: LoadService: -> jruby/java/java_module
2012-12-13T14:07:09.957-02:00: LoadService: <- jruby/java/java_module - 21ms
2012-12-13T14:07:09.957-02:00: LoadService: -> jruby/java/java_package_module_template
2012-12-13T14:07:09.970-02:00: LoadService: <- jruby/java/java_package_module_template - 13ms
2012-12-13T14:07:09.970-02:00: LoadService: -> jruby/java/java_utilities
2012-12-13T14:07:09.983-02:00: LoadService: <- jruby/java/java_utilities - 13ms