Skip to content

Instantly share code, notes, and snippets.

View nenodias's full-sized avatar

Horácio Dias Baptista Neto nenodias

View GitHub Profile
@nenodias
nenodias / Postman.collection.json
Last active March 29, 2023 00:32
Go Kafka Avro Producer
{
"info": {
"_postman_id": "69fd76f6-9327-4ba9-9359-2d8e0f5ba477",
"name": "SchemaRegistry",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "POST",
"event": [
@nenodias
nenodias / main.go
Created March 20, 2023 14:06
Server-Test
package main
import (
"fmt"
"io"
"net/http"
"os"
"github.com/google/uuid"
)
@nenodias
nenodias / cron.php
Last active October 7, 2022 01:58
Cron em php
<?php
function limparRegistrosDestaque($db){
$stmt = $db->prepare("UPDATE produtos SET todays_deal=?");
return $stmt->execute([0]);
}
function buscarRegistrosAleatorios($db, $quantidade){
$stmt = $db->prepare("SELECT * FROM produtos ORDER BY rand() limit $quantidade");
@nenodias
nenodias / README.md
Created August 27, 2022 20:47
Functional Javascript

challenge

@nenodias
nenodias / README.md
Last active August 13, 2022 14:20
Zerolog xorm

Xorm Engine can receive a Struct that implements the interface Logger from "xorm.io/xorm/log"

This example can be used for padronize the xorm logs with json format from zerlog.

type Logger interface {
	Debug(v ...interface{})
	Debugf(format string, v ...interface{})
	Error(v ...interface{})
	Errorf(format string, v ...interface{})
@nenodias
nenodias / app.py
Created August 9, 2022 02:31
Flask app without using decorator with @
from flask import Flask
app = Flask(__name__)
def hello():
return "Hello world"
app.route("/", methods=['get'])(hello)
@nenodias
nenodias / app.py
Created March 29, 2022 14:13
Flask WTF FieldList add and remove feature
from flask import Flask, render_template, request, redirect, url_for
from flask_wtf import FlaskForm
from wtforms import StringField, FormField, FieldList, IntegerField, Form
from wtforms.validators import Optional
from collections import namedtuple
app = Flask(__name__)
app.config['SECRET_KEY'] = 'keepthissecret'
class ProductForm(Form):
@nenodias
nenodias / flask.md
Last active May 6, 2022 02:20
Ebook monitoria sobre flask (usar o https://md2pdf.netlify.app/ para gerar ebook)
@nenodias
nenodias / README.md
Last active December 21, 2021 11:15
Kubernetes Helper

List all contexts configured at your computer

kubectl config get-contexts

Define which context you are working

kubectl config use-context


Create

kubectl create -f

@nenodias
nenodias / exercicio.py
Last active July 21, 2021 16:26
Exercício 4.8
'''
Escreva um programa que leia dois números e pergunte qual operação você deseja realizar.
Você deve poder realizar a soma (+), subtração (-), a multiplicação (*) e a divisão (/).
Exiba o resultado da operação solicitada.
'''
# Lendo o primeiro número
n1 = float(input('Digite um numero: '))
# Lendo o segundo número
n2 = float(input('Digite um numero: '))