Skip to content

Instantly share code, notes, and snippets.

@fabrizzio-gz
fabrizzio-gz / build.sql
Last active May 30, 2021 02:12
Postgres & Node.js using node-postgres tutorial src: https://onestepcode.com/postgres-nodejs-tutorial/
-- Setting up database
-- sudo -u posrgres
CREATE USER my_user WITH PASSWORD '12356';
CREATE DATABASE db WITH OWNER='my_user';
-- sudo -u my_user psql db
CREATE TABLE my_table(
id int,
name text,
@fabrizzio-gz
fabrizzio-gz / index.html
Last active January 30, 2023 15:07
Zoom and pan effects on a SVG element [demo](https://onestepcode.com/zoom-pan-effect-svg)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="container">
@fabrizzio-gz
fabrizzio-gz / Multiple file C program.md
Last active January 30, 2021 20:25
Dividing a C program into multiple files demonstration.

Dividing a C program into multiple files

Example initial file: main_single_file.c.

Divided into several files:

  • main.c
  • types.h
  • special_functions.c
  • special_functions.h
@fabrizzio-gz
fabrizzio-gz / App.js
Created December 3, 2020 01:33
Changing the label and arrow color of a Material-UI component demo [https://onestepcode.com/materialui-select-label-arrow-color/]
import SelectComp from "./selectcomp";
function App() {
return <SelectComp />;
}
export default App;
# Sudoku solver from https://onestepcode.com/
from copy import deepcopy
from typing import Callable
import numpy as np
def create_grid(puzzle_str: str) -> np.ndarray:
"""Create a 9x9 Sudoku grid from a string"""
@fabrizzio-gz
fabrizzio-gz / main.py
Last active August 9, 2020 02:27
A text-only tic-tac-toe game. To play the game, launch main.py with a Python interpreter.
from itertools import cycle
from random import shuffle
import numpy as np
### TODO:
# - 2 player mode.
# - Choose player/cpu token.
class NoMove(Exception):