Skip to content

Instantly share code, notes, and snippets.

View altherlex's full-sized avatar

Alther Alves altherlex

View GitHub Profile
The Top 30 French Movies of all time 🇫🇷✨⁣
1. LA HAINE de Matthieu Kassovitz (1995)⁣
2. LE FABULEUX DESTIN D’AMÉLIE POULAIN de Jean-Pierre Jeunet (1999)⁣
3. L’ARMÉE DES OMBRES de Jean-Pierre Melville (1969)⁣
4. LÉON de Luc Besson (1994)⁣
5. INTOUCHABLES d’Olivier Nakache et Éric Toledano (2011)⁣
6. LE TROU de Jacques Becker (1960)⁣
7. LES TONTONS FLINGUEURS de Georges Lautner (1963)⁣
8. LA CITÉ DE LA PEUR d’Alain Berbérian (1994)⁣
@altherlex
altherlex / ntt-evaluation.rb
Last active September 30, 2024 19:23
par programming with NTT
SCORE = {
"A":1,
"E":1,
"I":1,
"O":1,
"U":1,
"L":1,
"N":1,
"R":1,
"S":1,
@altherlex
altherlex / dataannotation.py
Created April 20, 2024 18:50
Code assesment for Dataannotation: python
# Script for https://app.dataannotation.tech/workers/starter_assessment_complete
# Instructions: https://github.com/altherlex/firekamp/blob/main/app/assets/dataannotation-assessment.png
# File: https://github.com/altherlex/firekamp/blob/main/app/assets/coding_qual_input.txt
def create_staircase(nums):
step = 1
subsets = []
while len(nums) != 0:
if len(nums) >= step:
subsets.append(nums[0:step])
@altherlex
altherlex / benchmark.rb
Created September 16, 2022 21:43
ruby Benchmark
seconds = Benchmark.realtime do
counted_links = {}
links.each { |e| counted_links[e] = links.count(e) if counted_links[e].nil?}
end
seconds
@altherlex
altherlex / tunnel-gateway.ssh
Created July 6, 2022 16:53
Dump mysql via tunnel
# Create tunnel gateway
$ ssh -L 3306:staging-bastion:3306 tunnel@staging-bastion
# Check the port
$ nc -z localhost 3306
# Dump via tunnel
$ mysqldump -P 3306 -ualther -p '9E@EeM#C)(Ip$n%9Cy6EIr}QyD!ZbFd' staging_myhi > staging_myhi.sql -h staging-myhi.csqfg2d4yaps.ca-central-1.rds.amazonaws.co
# - with gzip
@altherlex
altherlex / main.py
Created June 6, 2022 22:43
First step in Python
from datetime import date
nome=input('Qual é o seu nome? ')
print(f"Olá, {nome}! Prazer em te conhecer!")
dia=input('Qual é o dia do seu nascimento? ')
mes=input('Qual o mês? ')
ano=input('E o ano? ')
int_ano = int(ano)
@altherlex
altherlex / docker-main-cmds.md
Last active June 18, 2022 07:28
Docker main commands
# list of all images on your system
$ docker images

# run a command on image busybox
$ docker run busybox echo "hello from busybox"

# shows containers that are currently running
docker ps 
@altherlex
altherlex / code.md
Created May 26, 2022 06:52
Biggest script in one line only

Bigest script in one line

Show me your biggest code done in one line only.

lib['data'].select{|i| i['cover']['src'].nil? and images.find{|img| img[:q] == i['title']+' '+i['author']}}.each_with_index{|v, i| lib['data'].find{|l| l['book_id'] == v['book_id']}['cover'] = get_it.call(images.find{|img| img[:q] == v['title']+' '+v['author']}[:id]) }
@altherlex
altherlex / rails.rb
Created May 9, 2022 17:59
Catching rails/ruby upgrading errors
# module WarningHandlers
# module Rails
# class Deprecation < StandardError; end
# def self.register_deprecation_handler
# ActiveSupport::Notifications.subscribe('deprecation.rails') do |_name, _start, _finish, _id, payload|
# exception = Deprecation.new(payload[:message])
# Bugsnag.notify(exception) do |report|
# report.severity = 'warning'
@altherlex
altherlex / ebbundle
Last active May 4, 2022 22:18
Prepare Rails app for EB deploy
#!/bin/bash -eu
#
# Usage:
# $ cd $app_repo
# $ $infra_repo/myhi/deploy/ebbundle
#
# TODO: if branch == production, store an extra copy of the artifact (with the assets) in S3
# TODO: lifecycle for this