Skip to content

Instantly share code, notes, and snippets.

View aitor's full-sized avatar
👊
Working!

Aitor García Rey aitor

👊
Working!
View GitHub Profile
@aitor
aitor / mermaid.md
Last active June 15, 2023 13:36 — forked from martinwoodward/mermaid.md
GitHub HTML Rendering Pipeline
flowchart TB
    "Failed Payment delivery"-->Policies
    subgraph Retry System
    Policies-->Retrier
    end
    Retrier-->"Selected Action"
@aitor
aitor / README.md
Created October 13, 2019 17:13 — forked from igorwwwwwwwwwwwwwwwwwwww/README.md
clickhouse-playground

clickhouse-playground

capture logs:

heroku logs --tail -a travis-api-production | grep at=info | gsed -e 's/^\([0-9]*-[0-9]*-[0-9]*\)T\([0-9]*:[0-9]*:[0-9]*\)/date=\1 time="\1 \2" /' | lcut date time method path host request_id fwd dyno connect service status bytes > access.log

boot:

# frozen_string_literal: true
class TaxidValidator < ActiveModel::EachValidator
VALID_FORMATS = {
nif: /^(\d{8})([A-Z])$/,
nie: /^[XYZ]\d{7,8}[A-Z]$/,
}.freeze
CONTROL_DIGIT_TABLE = %w[T R W A G M Y F P D X B N J Z S Q V H L C K E].freeze
CONTROL_DIGIT_NIE_MAPPING = {
# Trigger a travis build
post "/push-webhook" do
uri = URI.parse("https://api.travis-ci.org/repo/your-org/your-repo/requests")
request = Net::HTTP::Get.new(uri.request_uri)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Travis-API-Version"] = "3"
request["Authorization"] = "token your-token"
private Environment(String ip, String mac, String iccid, String imei,
String carrier, String device, String os, String androidId,
String localization) {
this.ip = ip;
this.mac = mac;
this.iccid = iccid;
this.imei = imei;
this.carrier = carrier;
this.device = device;
this.os = os;
#!/usr/bin/env bash
set -ex
# Pass in Heroku API token
token=$1
# We run this script in a stateless Docker image, so to make the script a bit
# cleaner, we just write out the credentials to a file that the Heroku Toolbelt
# knows to read.
> pip2.7 install otpsecure  
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting otpsecure
Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python2.7/site-packages (from otpsecure) (4.8.0)
Requirement already satisfied: pycrypto>=2.6.1 in /usr/local/lib/python2.7/site-packages (from otpsecure) (2.6.1)
Requirement already satisfied: requests>=2.4.1 in /usr/local/lib/python2.7/site-packages (from otpsecure) (2.22.0)
Requirement already satisfied: soupsieve>=1.2 in /usr/local/lib/python2.7/site-packages (from beautifulsoup4->otpsecure) (1.9.2)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python2.7/sit
@aitor
aitor / authenticate_user_spec.rb
Last active July 23, 2019 16:59
Service / Usecase Objects in vanilla Ruby
describe AuthenticateManagerService do
subject(:context) { described_class.call(username, password) }
describe '.call' do
context 'when the context is successful' do
let(:username) { 'correct_user' }
let(:password) { 'magic' }
it 'succeeds' do
expect(context).to be_success
// Source at https://developer.paypal.com/js/pages/docs/integration/direct/identity/lipp-button.js
//...
function _getConfig() {
var confObj = {};
var builders = buildForm.querySelectorAll('input, select');
var i = 0;
var el;
@aitor
aitor / asdf_elixir.sh
Created December 31, 2018 12:34
POWERLEVEL9K custom elixir/erlang prompt segment
POWERLEVEL9K_ELIXIR_ICON=$'\ue62d'
prompt_asdf_elixir() {
if [ $commands[asdf] ]; then
ELIXIR_ICON=$'\ue62d'
local asdf_global_conf="$HOME/.tool-versions"
local version_regex="s/^\([.0-9]*\).*/\1/p"
local config_regex="s/.*(set by \(.*\))/\1/p"
local elixir_current="$(asdf current elixir)"
local elixir_current_version="$(echo $elixir_current | sed -n $version_regex)"