Skip to content

Instantly share code, notes, and snippets.

View girorme's full-sized avatar
😀

girorme girorme

😀
View GitHub Profile
@girorme
girorme / pre-commit
Created October 10, 2019 17:52
super-giggle pre-commit hook
#!/usr/bin/env bash
SG="super-giggle"
$SG --diff-cached
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo 'Meus parabéns, meu filho. Seu código está limpinho. Meus parabéns!!!'
else
# Permite capturar a resposta Y|N do usuário.
exec < /dev/tty
MSG=$(cat << "EOF"
<?php
class HttpGrabThreaded {
private array $urls;
private array $runtimes;
private array $futures;
public function __construct(array $urls)
{
@girorme
girorme / php-compile-with-parallel.sh
Last active January 5, 2020 01:02
php compile script with parallel
#!/bin/bash
#
# ** Need install system dependencies
rm -rf php-src/
mkdir -p /etc/php7
mkdir -p /etc/php7/cli
git clone https://github.com/php/php-src.git -b PHP-7.4.1 --depth=1
@girorme
girorme / Dockerfile
Last active February 10, 2020 02:51
Elixir docker skeleton
# Use an official Elixir runtime as a parent image
FROM elixir:latest
RUN apt-get update && \
apt-get install -y postgresql-client
# Create app directory and copy the Elixir projects into it
RUN mkdir /app
COPY . /app
WORKDIR /app
@girorme
girorme / connect.sh
Last active April 8, 2020 23:12
otp authentication openfortivpn
# --trusted-cert value is prompted in the first on debug output while connection try
sudo /usr/bin/openfortivpn ip:port -u user --trusted-cert 9f069d6b9e248de3a7521981ef06377b296574fa5825cde10b7349da62939c80 --otp-prompt=1 --no-dns
@girorme
girorme / perguntas-entrevistador.md
Created October 1, 2020 14:59
Perguntas para fazer em uma entrevista - Créditos: Gabs Ferreira

Qual será o meu trabalho no dia a dia?

Saber em que projeto você irá trabalhar e como será sua rotina de trabalho é essencial.

Como os times são organizados?

Quantos devs tem no time? Quantos líderes?

Qual a stack de tecnologias utilizadas na empresa?

@girorme
girorme / worker-pool.go
Last active May 8, 2024 18:24
worker pool using go channels + waitGroup
package main
import (
"flag"
"fmt"
"net/http"
"sync"
"threadsync/httpclient"
"time"
)
<?php
interface Entity {
}
class Book implements Entity {
}
// REPO
interface Repository {
@girorme
girorme / solution.ex
Last active May 16, 2022 20:54
tdd livebook
defmodule Solution do
def remove_duplicate_chars(string) do
string
|> String.codepoints()
|> Enum.reduce(fn char, acc ->
acc = if String.contains?(acc, char) do
acc
else
acc <> char
end
@girorme
girorme / read-mails-elixir.ex
Last active March 3, 2023 17:32
Read emails imap
defmodule ImapExample do
def mark_unread_emails_as_read(server, username, password) do
{:ok, conn} = ExImap.connect(server: server, ssl: true)
{:ok, _} = ExImap.authenticate(conn, username: username, password: password)
{:ok, _} = ExImap.select(conn, "INBOX")
{:ok, messages} = ExImap.search(conn, "UNSEEN")
Enum.each(messages, fn msg_id ->
{:ok, _} = ExImap.store(conn, msg_id, "+FLAGS", "\\Seen")
end)