Skip to content

Instantly share code, notes, and snippets.

View wilyJ80's full-sized avatar
💭
🍪

Victor Hugo wilyJ80

💭
🍪
View GitHub Profile
@wilyJ80
wilyJ80 / migration.js
Created February 28, 2025 13:18
connect-pg-simple cookie table in node-pg-migrate syntax
exports.shorthands = undefined;
exports.up = (pgm) => {
pgm.createTable("session", {
sid: { type: "varchar", notNull: true, primaryKey: true },
sess: { type: "json", notNull: true },
expire: { type: "timestamp(6)", notNull: true },
});
pgm.createIndex("session", "expire", { name: "IDX_session_expire" });
@wilyJ80
wilyJ80 / init.lua
Created February 11, 2025 22:22
server neovim config
vim.o.tabstop = 4
vim.o.softtabstop = 4
vim.o.shiftwidth = 4
vim.opt.number = true
-- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
@wilyJ80
wilyJ80 / lexer.js
Last active February 16, 2025 21:00
JS class-based table-driven lexer for a simple Forth
import * as readline from 'node:readline/promises';
import { stdin as input, stdout as output } from 'node:process';
/* valid tokens:
numbers (consisting of digits),
words (consisting of alnum chars),
comment (ignore)
*/
const Transition = class {
#nextState;
@wilyJ80
wilyJ80 / matched.c
Created January 1, 2025 18:12
matched
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Exp_T {
const char *str;
int index;
int length;
int token;
@wilyJ80
wilyJ80 / exemplo.proc
Created November 19, 2024 13:14
exemplo.proc
// Calcular fatorial iterativo
pr init
int fat = 1, n = 1, z
getint n
if (n <= 1)
fat = 1
else
fat = n
z = n
@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 / 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 / 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".