Skip to content

Instantly share code, notes, and snippets.

Avatar

fabrizzio.gz fabrizzio-gz

View GitHub Profile
@fabrizzio-gz
fabrizzio-gz / main.py
Last active Aug 9, 2020
A text-only tic-tac-toe game. To play the game, launch main.py with a Python interpreter.
View main.py
from itertools import cycle
from random import shuffle
import numpy as np
### TODO:
# - 2 player mode.
# - Choose player/cpu token.
class NoMove(Exception):
View sudoku_solver.py
# 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 / App.js
Created Dec 3, 2020
Changing the label and arrow color of a Material-UI component demo [https://onestepcode.com/materialui-select-label-arrow-color/]
View App.js
import SelectComp from "./selectcomp";
function App() {
return <SelectComp />;
}
export default App;
@fabrizzio-gz
fabrizzio-gz / Multiple file C program.md
Last active Jan 30, 2021
Dividing a C program into multiple files demonstration.
View Multiple file C program.md

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 / index.html
Last active Oct 22, 2021
Zoom and pan effects on a SVG element [demo](https://onestepcode.com/zoom-pan-effect-svg)
View index.html
<!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 / build.sql
Last active May 30, 2021
Postgres & Node.js using node-postgres tutorial src: https://onestepcode.com/postgres-nodejs-tutorial/
View build.sql
-- 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,