Skip to content

Instantly share code, notes, and snippets.

View wilyJ80's full-sized avatar
💭
🍪

Victor Hugo wilyJ80

💭
🍪
View GitHub Profile
@wilyJ80
wilyJ80 / read.c
Created June 18, 2025 11:36
beginners guide away from scanf
/* https://web.archive.org/web/20250417094758/https://sekrit.de/webdocs/c/beginners-guide-away-from-scanf.html */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int main(void)
{
long a;
char buf[1024]; // use 1KiB just to be sure
@wilyJ80
wilyJ80 / pom.xml
Created June 9, 2025 13:11
Spring MVC + Standalone Tailwind CLI
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.0</version>
<relativePath /> <!-- lookup parent from repository -->
@wilyJ80
wilyJ80 / pom.xml
Created June 9, 2025 12:07
Pom XML for fat JAR + CLI program before compile
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>exectest</groupId>
<artifactId>exectest</artifactId>
<version>1.0-SNAPSHOT</version>
<name>exectest</name>
@wilyJ80
wilyJ80 / blinkrotate.ino
Created May 30, 2025 01:16
OOP button with states
#define RED_PIN 2
#define YELLOW_PIN 3
#define BUTTON_PIN 4
struct Sketch {
int status;
int cur;
int prev;
void (*resetPins)(struct Sketch *self);
void (*rotateState)(struct Sketch *self);
@wilyJ80
wilyJ80 / main.c
Last active April 3, 2025 13:13
Half adder (CLI args)
#include <stdio.h>
#include <stdlib.h>
#include "./utils.h"
int main(int argc, char** argv) {
if (argc != 3) {
fprintf(stderr, "Error: expected 2 args (numbers)\n");
exit(EXIT_FAILURE);
}
@wilyJ80
wilyJ80 / search.sql
Last active May 20, 2025 18:32
FB db text search utils
set term ^ ;
execute block
returns (
RESULT1 varchar(255), RESULT2 varchar(255),
RESULT3 BLOB, result4 varchar(255) )
as
declare search_query varchar(32) = 'PAC';
BEGIN
@wilyJ80
wilyJ80 / test.ino
Created March 9, 2025 17:30
global string test
/*******************************************************************
A telegram bot for your ESP32 that demonstrates a bot
that show bot action message
Parts:
ESP32 D1 Mini style Dev board* - http://s.click.aliexpress.com/e/C6ds4my
(or any ESP32 board)
= Affilate
@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;