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 / 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: '))
@nenodias
nenodias / Readme.md
Created May 17, 2021 21:52
Converting rmvb to mp4

Converting rmvb to mp4

Installing ffmpeg on ubuntu

sudo apt install ffmpeg

chamge the dir to where are your files

cd <folder with .rmvb files>

Just run convert file that it will look on this dir for all .rmvb files for converting

python3 convert.py