Skip to content

Instantly share code, notes, and snippets.

View fhpriamo's full-sized avatar
👋
Hello!

Fábio Priamo fhpriamo

👋
Hello!
View GitHub Profile
class Note
class MalformedNotationError < StandardError
end
A4_FREQUENCY = 440
STEP_FREQUENCY_FACTOR = 1.059463094359
INTERVALS = {'C' => 0, 'C#' => 1, 'Db' => 1, 'D' => 2,
@fhpriamo
fhpriamo / timer.html
Last active July 11, 2019 19:48
My first approach to @Flight. This is a small app I cooked up in order to grasp some Twitter Flight basics.
<!DOCTYPE html>
<html>
<head>
<title>Twitter Flight Timer</title>
<meta http-equiv="Cache-Control" content="no-store" />
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/2.3.0/es5-shim.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/2.3.0/es5-sham.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/flight/1.1.3/flight.min.js"></script>
<style type="text/css">
@fhpriamo
fhpriamo / smtp-gmail-send.go
Created March 27, 2017 22:18 — forked from jpillora/smtp-gmail-send.go
Send email using Go (Golang) via GMail with net/smtp
package main
import (
"log"
"net/smtp"
)
func main() {
send("hello there")
}
@fhpriamo
fhpriamo / bracomecanico.ino
Created April 7, 2017 18:18
Lógica para o hardware de comparação de cores
// bracomecanico-0.0.0.ino
//
// Projeto Braço Mecânico
//
// Revisão 0.0.0
// Data: Abril de 2017
// Universidade: Doctum
// Disciplina: Integradora
// Professor(a): Danielle Alcantara
// Autores:
package tcmrc
import (
"bufio"
"bytes"
"fmt"
"os"
)
type HexFile struct {

Kafka 0.11.0.0 (Confluent 3.3.0) added support to manipulate offsets for a consumer group via cli kafka-consumer-groups command.

  1. List the topics to which the group is subscribed
kafka-consumer-groups --bootstrap-server <kafkahost:port> --group <group_id> --describe

Note the values under "CURRENT-OFFSET" and "LOG-END-OFFSET". "CURRENT-OFFSET" is the offset where this consumer group is currently at in each of the partitions.

  1. Reset the consumer offset for a topic (preview)
/**
* MIT License
*
* Copyright (c) 2020 Rodrigo Martins
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights *
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
import { createHash } from 'crypto';
import fs from 'fs';
import { basename } from 'path';
/**
* An abstraction for a buffered file suitable to be used
* in tests (specially upload tests).
*
* Buffering and digesting are deffered until they are used.
*/
//
// src/lib/html
//
export const DOCTYPE_TAG = `<!DOCTYPE html>`;
const HTML_ESCAPES = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
const assert = require('assert');
/**
* Compares 2 arrays in any order.
*/
function arrayEquals(arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
}