Skip to content

Instantly share code, notes, and snippets.

View raninho's full-sized avatar
🤖
Simulating what is human.

Raniere Medeiros raninho

🤖
Simulating what is human.
View GitHub Profile
from datetime import datetime, timedelta
import random
# Parâmetros default
max_attempt = 5
backoff_seconds = 18000
backoff_factor = 2
jitter_min_seconds = 0
jitter_max_seconds = 300
last_attempt_time_str = "25/01/2024 12:00:00"
@raninho
raninho / Environment
Created May 18, 2022 22:21
Class to create env var in Java
import com.google.common.annotations.VisibleForTesting;
import java.lang.reflect.Field;
import java.util.Map;
@VisibleForTesting
public class Environment {
public static void set(String key, String value) {
try {
Map<String, String> env = System.getenv();
@raninho
raninho / download_s3.py
Created September 24, 2020 00:28
boto3 and s3
import boto3
import json
from urllib.parse import urlparse
BUCKET_NAME = 'bucket-name'
session = boto3.Session(
aws_access_key_id="secret-id",
aws_secret_access_key="secret-access-key"
)
from datetime import datetime, timedelta
if __name__ == "__main__":
date1 = "15:59:02"
date2 = "16:59:02"
d1 = datetime.strptime(date1, "%H:%M:%S")
d2 = datetime.strptime(date2, "%H:%M:%S")
d = d2 - d1
print(d.total_seconds())

Keybase proof

I hereby claim:

  • I am raninho on github.
  • I am raninho (https://keybase.io/raninho) on keybase.
  • I have a public key ASC1dLMYdsyJ8iJxMNnvqvpMOiKfQYdT_XMsUqTP_rLDSwo

To claim this, I am signing this object:

package main
import (
"fmt"
"github.com/Nhanderu/brdoc"
)
var (
cpfs = []string{
@raninho
raninho / foo.go
Created December 4, 2018 22:20
BubbleSort example
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
@raninho
raninho / gist:8bfd9e5277948551825e38aa16223c21
Created November 30, 2018 21:17
Request With Two Way SSL With Golang
package main
import (
"bytes"
"crypto/tls"
"encoding/base64"
"io"
"io/ioutil"
"log"
"net/http"
# coding: utf-8
from time import sleep
from random import randint
from datetime import datetime
import lxml.html
import requests
URL = "http://saber.pb.gov.br/users/sign_in"
USER = "[email protected]"
@raninho
raninho / gist:9092928
Created February 19, 2014 14:13
vimrc
syntax on
set encoding=utf-8
set nocompatible
set backspace=indent,eol,start
set tabstop=4
set shiftwidth=4
set scrolloff=2
set laststatus=2
set showtabline=2