Skip to content

Instantly share code, notes, and snippets.

View wilyJ80's full-sized avatar

Victor Hugo wilyJ80

View GitHub Profile
@wilyJ80
wilyJ80 / index.html
Created September 20, 2024 22:03
Poke download
<html>
<body>
<h1>Try poking!</h1>
<button>POKE</button>
<p>Pokes: 0</p>
<a href="#">Download poke count</a>
<script src="./script.js"></script>
</body>
</html>
@wilyJ80
wilyJ80 / regex.js
Created September 18, 2024 19:10
js multiline regex with comments?
const pattern = new RegExp([
'\\d{3}', // Area code
'\\s*', // Optional whitespace
'-?', // Optional dash
'\\d{4}' // Main number
].join(''), 'g');
const match = '123 4567'.match(pattern);
console.log(match[0]); // "123 4567"
@wilyJ80
wilyJ80 / auto.dot
Created September 3, 2024 13:46
Automata: even number of as and bs
/* Automato finito: w possui um numero par de a e b */
digraph {
zero;
one;
two;
node [shape="doublecircle"];
three;
/* estado inicial */
@wilyJ80
wilyJ80 / node.md
Created September 2, 2024 15:40
node

Node.js

  • Node.js é um ambiente de execução de JavaScript open source e disponível para várias plataformas além dos navegadores web, ambiente onde tal linguagem foi inicialmente projetada, basicamente permitindo que o JavaScript possa ser executado fora do ambiente do navegador, nativamente em máquinas.

  • Node.js possui uma arquitetura assíncrona, permitindo concorrência nativamente, o que é altamente desejável no caso de operações de entrada e saída tais como requisições de rede. O Node.js é composto de apenas uma thread, contendo um loop de eventos para gerenciar essa concorrência.

  • O Node.js é escrito em C, C++, e JavaScript, sendo as partes mais notórias em C (biblioteca libuv, para operações assíncronas) e C++ (interpretador V8 da Google, máquina virtual JavaScript).

  • A biblioteca HTTP do Node.js é um dos vários módulos de sua biblioteca padrão, primariamente escrito em C++.

@wilyJ80
wilyJ80 / regex.sh
Created August 26, 2024 22:07
Exercicio 1 regex
#!/bin/bash
test_words() {
local pattern=$1
shift
local words=("$@")
for word in "${words[@]}"
do
if ! echo "$word" | grep -E "$pattern" > /dev/null ; then
@wilyJ80
wilyJ80 / anotacoes.md
Created August 26, 2024 15:18
caddy resumo
  • Caddy é um servidor HTTPS conhecido por sua facilidade de configuração e certificados TLS garantidos por padrão.

  • Fácil de executar, com o comando caddy run. As requisições nesse presente trabalho foram realizadas com curl.

    • O teste inicial foi realizado com o endpoint localhost:2019/config, que retornou HTML, como indicado pela configuração.
  • Configuração simples: podendo ser realizada em JSON ou um arquivo de configuração chamado de Caddyfile.

Continuar: https://caddyserver.com/docs/getting-started

@wilyJ80
wilyJ80 / error.md
Created August 23, 2024 23:10
bem server error
 ✔ Network bem-server_backend  Created                                                                                                                                  0.1s 
 ✔ Container pgsql             Created                                                                                                                                  0.1s 
 ✔ Container bem-server        Created                                                                                                                                  0.0s 
 ✔ Container nginx-bem-server  Created                                                                                                                                  0.1s 
Attaching to bem-server, nginx-bem-server, pgsql
pgsql             | The files belonging to this database system will be owned by user "postgres".
pgsql             | This user must also own the server process.
pgsql             | 
pgsql             | The database cluster will be initialized with locale "en_US.utf8".
@wilyJ80
wilyJ80 / script.md
Last active June 18, 2024 15:59
plasticome notes

Plasticome Docker ArchLinux

  • install python3.10

  • TODO: Install correct python version

pacman -Sy python3 --noconfirm

  • Create user, to use yay
@wilyJ80
wilyJ80 / sort-words.py
Last active May 31, 2024 20:59
Python word sorter: multi-file, supports subdirectories, no loops
#!/usr/bin/env python3
# Sorts words each on its own line, on any number of files
from pathlib import Path
import timeit
def sorter():
files = list(filter(lambda x: x.is_file(), Path('.').rglob('*')))
@wilyJ80
wilyJ80 / Dockerfile
Last active June 4, 2024 10:31
Lapis Framework Dev Container
FROM alpine:3.12
LABEL org.opencontainers.image.source="https://github.com/MilesChou/docker-lapis" \
repository="https://github.com/MilesChou/docker-lapis" \
maintainer="MilesChou <github.com/MilesChou>"
# Ref https://github.com/openresty/docker-openresty/blob/master/alpine/Dockerfile
ARG OPENRESTY_CONFIG_OPTIONS="\
--with-http_auth_request_module \
--with-http_gunzip_module \