Skip to content

Instantly share code, notes, and snippets.

View jhonata-menezes's full-sized avatar
🏠
Working ...

Jhonata Menezes jhonata-menezes

🏠
Working ...
View GitHub Profile
@tomekbielaszewski
tomekbielaszewski / main.go
Last active August 17, 2023 19:22
Example of RabbitMQ reconnect feature. Including recovering already registered consumers.
package main
import (
"fmt"
"log"
"time"
)
func main() {
queue := NewQueue("amqp://guest:guest@localhost:5672/", "hello")
@achesco
achesco / generate-pg-ssl.md
Last active May 9, 2024 16:47
Generate self-signed SSL certificates for PostgreSQL server and client

CNs are important!!! -days 3650

Create a Certificate Signing Request (CN=localhost)

umask u=rw,go= && openssl req -days 3650 -new -text -nodes -subj '/C=US/ST=Massachusetts/L=Bedford/O=Personal/OU=Personal/emailAddress=example@example.com/CN=localhost' -keyout server.key -out server.csr

Generate self-signed certificate

umask u=rw,go= && openssl req -days 3650 -x509 -text -in server.csr -key server.key -out server.crt
@martinrisseeuw
martinrisseeuw / correct.vue
Last active June 2, 2020 04:35
Mapbox Nuxt component
<template>
<div id="map" class="map">
<div class="button-bar">
<button v-on:click="addMapLayer()">terrain</button>
</div>
</div>
</template>
<script>
@jhonata-menezes
jhonata-menezes / guzzle_change_body.php
Last active August 29, 2019 06:11
Guzzle 6: change body response
<?php
/**
* sources:
* http://docs.guzzlephp.org/en/latest/handlers-and-middleware.html#middleware
* https://evertpot.com/222/
*
*/
use GuzzleHttp\Client;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
@jthatch
jthatch / dnsresolve.js
Created December 23, 2016 11:26
Scan known google proxy IP subnets to determine if said ip's are google proxys. - This is written to help us detect traffic originating from google's "data saver" mobile chrome feature
#!/usr/bin/env node
/*
* dnsresolve.js
* Will resolve ip ranges to determine if they're google proxies.
*
* TIPS for increasing speed:
* Run on multi-core system
* ulimit -n 40000
*
* Examples:
@z3ntu
z3ntu / sysbench.md
Last active May 25, 2020 15:44
Sysbench values for my different computers/servers

Sysbench benchmarks

Tested with sysbench 0.4.12 (Command: sysbench --test=cpu --num-threads=$numThreads run)

HP ProBook

CPU: Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz

  • 1 thread: 10.3467s
  • 4 threads: 2.9861s
  • 8 threads: 3.0074s

My computer at home

Github Two-Factor Authentication (2FA) for Brazil via SMS

The Github doesn't provide country code for Brazil (+55). To add this option, just run the code below in your console. The option Brazil +55 will be the first on the list, already selected:


🇧🇷 [pt-BR]

Autenticação em dois fatores (2FA) do GitHub para o Brasil via SMS

@luizgpsantos
luizgpsantos / Exemplo completo
Last active May 4, 2024 16:31
Analyzer para plural e acentos no elasticsearch
// Ao [criar o índice][0], especifique um [analyzer customizado][1] responsável por tratar palavras
// com caracteres especiais e o plural da lingua Portuguesa. Algumas palavras precisarão de uma
// sintonia fina, o que pode ser feito através de [stemmer overrides][2]. Além disso, ao criar um
// campo atribua o analyzer a ele.
PUT produtos
{
"settings": {
"analysis": {
"analyzer": {
@jmcnamara
jmcnamara / bench_excel_writers.py
Last active June 5, 2024 14:32
Benchmark of several Python Excel writing modules
##############################################################################
#
# Simple Python program to benchmark several Python Excel writing modules.
#
# python bench_excel_writers.py [num_rows] [num_cols]
#
#
import sys
from time import clock
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 26, 2024 18:34
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'