Skip to content

Instantly share code, notes, and snippets.

View arielvalentin's full-sized avatar

Ariel Valentin arielvalentin

View GitHub Profile
context = Context.current
Fiber.new {
Context.with_context(context) do
# your fiber code
OpenTelemetry::Trace.current_span.finish
end
}
Thread ->
### Keybase proof
I hereby claim:
* I am arielvalentin on github.
* I am arielvalentin (https://keybase.io/arielvalentin) on keybase.
* I have a public key ASDdELUy6nPv1VvixRn17bdyqOEQZSfeTP59I4svCLsqVAo
To claim this, I am signing this object:
@arielvalentin
arielvalentin / Correct results
Last active August 23, 2017 15:58
Redshift Random Characters
Redshift Query ID 905905
psql> with
ld as (select distinct date_trunc('day', (day)::timestamp)::date as date, first_value(day) over (partition by date_trunc('day', (day)::timestamp)::date order by "day" desc rows unbounded preceding) as last_day from events.stripe_logic_views.ten_years_in_days_from_first_invoice where 1=1
) select
date
, add_on_plan_id
, sum(amortized_total_amount / 100) as total_mrr
from
stripe_logic_views.daily_mrr_by_customer d
@arielvalentin
arielvalentin / txt
Created August 23, 2017 15:03
Redshift Random Characters
psql> with
ld as (select distinct date_trunc('day', (day)::timestamp)::date as date, first_value(day) over (partition by date_trunc('day', (day)::timestamp)::date order by "day" desc rows unbounded preceding) as last_day from events.stripe_logic_views.ten_years_in_days_from_first_invoice where 1=1
) select
date
, add_on_plan_id
, sum(amortized_total_amount / 100) as total_mrr
from
stripe_logic_views.daily_mrr_by_customer d
join ld on
ld.last_day = d.day
@arielvalentin
arielvalentin / txt
Created August 23, 2017 15:03
Redshift Random Characters
psql> with
ld as (select distinct date_trunc('day', (day)::timestamp)::date as date, first_value(day) over (partition by date_trunc('day', (day)::timestamp)::date order by "day" desc rows unbounded preceding) as last_day from events.stripe_logic_views.ten_years_in_days_from_first_invoice where 1=1
) select
date
, add_on_plan_id
, sum(amortized_total_amount / 100) as total_mrr
from
stripe_logic_views.daily_mrr_by_customer d
join ld on
ld.last_day = d.day
@arielvalentin
arielvalentin / Success.log
Last active January 21, 2016 16:04
traceroute test results
→ traceroute -v -S -d www.att.net
traceroute to user-att-104-57-184-0.e8938.g.akamaiedge.net (172.226.108.142), 64 hops max, 52 byte packets
1 dsldevice.attlocal.net (192.168.1.254) 60 bytes to 192.168.1.85 1.567 ms 0.909 ms 0.759 ms (0% loss)
2 107-220-56-1.lightspeed.austtx.sbcglobal.net (107.220.56.1) 60 bytes to 192.168.1.85 15.635 ms 7.031 ms 2.771 ms (0% loss)
3 71.149.77.112 (71.149.77.112) 60 bytes to 192.168.1.85 4.537 ms 4.214 ms 3.676 ms (0% loss)
4 75.8.128.144 (75.8.128.144) 60 bytes to 192.168.1.85 4.284 ms 3.830 ms 3.517 ms (0% loss)
5 12.83.68.137 (12.83.68.137) 76 bytes to 192.168.1.85 5.886 ms
12.83.68.145 (12.83.68.145) 76 bytes to 192.168.1.85 6.912 ms
12.83.68.137 (12.83.68.137) 76 bytes to 192.168.1.85 7.159 ms (0% loss)
6 gar2.dlrtx.ip.att.net (12.122.100.89) 76 bytes to 192.168.1.85 12.416 ms 11.747 ms 14.065 ms (0% loss)
@arielvalentin
arielvalentin / extract_config.sh
Created December 21, 2015 17:14
Whenever I need to bootstrap a new dev ENV vars based on production
heroku config | grep -iv "Config Vars" | tr ':' '=' | tr -d '[:blank:]' | sed -e 's/production/development/g'`
@arielvalentin
arielvalentin / ssh-forward-agent
Created September 18, 2015 21:57
ssh forward-agent
#on the server in /etc/ssh/sshd_config
AllowAgentForwarding on
#on the server /home/ubuntu/.ssh/authorized_keys
# CONTENTS of my public key id_rsa
#on the client in ~/.ssh/config
Host remote_server
User ubuntu
ForwardAgent yes
@arielvalentin
arielvalentin / routing
Created July 15, 2015 17:03
Route VPN traffic through static route
mataleon:~ ariel$ ifconfig
....
ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1280
inet 192.168.80.8 --> 192.168.20.1 netmask 0xffffff00
mataleon:~ ariel$ sudo /sbin/route add -net 192.168.20.0/16 -interface ppp0
add net 192.168.20.0: gateway ppp0
mataleon:~ ariel$ ssh gust@192.168.20.35
Password:
#!/bin/bash
sudo rm -f /etc/racoon/remote/*
sudo cp /var/run/racoon/*.conf /etc/racoon/remote
sudo sed -i.bak 's/lifetime time 3600 sec/lifetime time 168 hours/' /etc/racoon/remote/*.conf
sudo patch /etc/racoon/racoon.conf <<EOF
--- /etc/racoon.orig/racoon.conf 2009-06-23 09:09:08.000000000 +0200
+++ /etc/racoon/racoon.conf 2009-12-11 13:52:11.000000000 +0100
@@ -135,4 +135,5 @@
# by including all files matching /var/run/racoon/*.conf
# This line should be added at the end of the racoon.conf file