Skip to content

Instantly share code, notes, and snippets.

View fhpriamo's full-sized avatar
👋
Hello!

Fábio Priamo fhpriamo

👋
Hello!
View GitHub Profile
@fhpriamo
fhpriamo / README.md
Created January 28, 2021 16:51 — forked from rubencaro/README.md
Python installation guide

Python installation guide

These are my notes, not a generic solution. They are not meant to work anywhere outside my machines. Update version numbers to whatever are the current ones while you do this.

Install asdf and its python plugin, then install Python

asdf lives in https://github.com/asdf-vm/asdf

Follow its installation instructions, which at the moment of writing were:

const { MyVeryUsefulProject } = require('../index');
const { getFooOfId, saveFoo } = require('../infrastructure/inMemory');
describe('Feature: updating bar', () => {
describe('scenario: updating bar with a value not containing a "?"', () => {
describe('given a foo object in database with the id foo1 and a bar value of "initial bar value"', () => {
describe('when updating the bar value to "some new value"', async (done) => {
test('then the foo object with id foo1 should have its bar value set to "some new value"', () => {
const inMemoryDatabase = {
foo1: {
@fhpriamo
fhpriamo / Every possible TypeScript type.md
Created September 1, 2020 18:04 — forked from laughinghan/Every possible TypeScript type.md
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything at all is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.

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)
@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")
}