Skip to content

Instantly share code, notes, and snippets.

View gicrisf's full-sized avatar

Giovanni Crisalfi gicrisf

View GitHub Profile
@karpathy
karpathy / microgpt.py
Last active February 17, 2026 02:44
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@griver
griver / switch-local-git-repo-to-fork.md
Created September 11, 2024 11:57 — forked from ElectricRCAircraftGuy/switch-local-git-repo-to-fork.md
How to move to a fork after cloning

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

To follow GitHub flow you should really have created a fork initially as a public representation of the forked repository and the clone that instead. My understanding is that the typical setup would have your local repository pointing to your fork as origin and the original forked repository as upstream so that you can use these keywords in other git commands.

  1. Clone some repo (you've probably already done this step).

    git clone git@github...some-repo.git
@bioluks
bioluks / nerd-fonts-complete-windows.bat
Last active September 19, 2025 15:37
Install all Nerd Fonts on Windows, using scoop. You will obviously need scoop (https://scoop.sh) and git on your Windows setup before executing this script, for now.
powershell -command "scoop bucket add nerd-fonts"
powershell -command "scoop install nerd-fonts/Monocraft-Nerd-Font nerd-fonts/Delugia-Mono-Nerd-Font nerd-fonts/Delugia-Nerd-Font nerd-fonts/Delugia-Nerd-Font-Book nerd-fonts/Delugia-Nerd-Font-Complete nerd-fonts/Delugia-Mono-Nerd-Font-Complete nerd-fonts/3270-NF-Mono nerd-fonts/Agave-NF-Mono nerd-fonts/AnonymousPro-NF-Mono nerd-fonts/Arimo-NF-Mono nerd-fonts/AurulentSansMono-NF-Mono nerd-fonts/BigBlueTerminal-NF-Mono nerd-fonts/BitstreamVeraSansMono-NF-Mono nerd-fonts/CascadiaCode-NF-Mono nerd-fonts/CodeNewRoman-NF-Mono nerd-fonts/ComicShannsMono-NF-Mono nerd-fonts/Cousine-NF-Mono nerd-fonts/DaddyTimeMono-NF-Mono nerd-fonts/DejaVuSansMono-NF-Mono nerd-fonts/DroidSansMono-NF-Mono nerd-fonts/FantasqueSansMono-NF-Mono nerd-fonts/FiraCode-NF-Mono nerd-fonts/FiraMono-NF-Mono nerd-fonts/Gohu-NF-Mono nerd-fonts/Hack-NF-Mono nerd-fonts/Hasklig-NF-Mono nerd-fonts/HeavyData-NF-Mono nerd-fonts/Hermit-NF-Mono nerd-fonts/IBMPlexMono-NF-Mono nerd-fonts/Inconsolata-NF-Mono n
@larrasket
larrasket / chess-babel.el
Last active November 19, 2025 20:59
Add org babel support for Portable Game Notation
;; this is another version that doesn't require any user parameters
(defun org-babel-execute:chess (body params)
"Execute a block of Chess code with org-babel.
This function is called by `org-babel-execute-src-block'."
(let* ((output-file (concat (file-name-sans-extension (buffer-file-name)) (format "_%s_chess_output.svg" (format-time-string "%Y-%m-%d_%H-%M-%S")) ))
(notation (cdr (assq :notation params)))
(extension (if (equal notation "fen") ".fen" ".pgn"))
(notation-file (make-temp-file "chess-notation" nil extension))
(cmd (format "python ~/configs/elchess.py %s %s %s" notation-file output-file notation)))
@hlissner
hlissner / capture.el
Last active March 30, 2025 14:49
Examples of Doom CLI scripts
#!/usr/bin/env doomscript
;; An example script showing off how use Doom's CLI framework to write your own.
(defcli! (capture)
((key ("-k" "--key" key))
&input input &args args)
"Open an org-capture window."
(exit! "emacsclient" "-a" "" "-e"
(format "(+org-capture/open-frame %S %S)"
(concat input (string-join args " "))
@peanutbutterandcrackers
peanutbutterandcrackers / Guix-DE-Integration.md
Last active December 1, 2025 10:16
Guix Desktop-Environment Integration Guide

Guix Desktop-Environment Integration:

A guide to better DE-Integration for the GNU Guix Package Manager.

This has been tried and tested (successfully) in the following desktop environments:

  • GNOME (Debian 10.2 'Buster')
  • MATE, XFCE, KDE (Linux Mint 19 'Tara')
  • Cinnammon (Linux Mint 19.1 'Tessa')
  • Pantheon (Elementary OS 5.0 'Juno')
@ahmed-musallam
ahmed-musallam / compress_pdf.md
Last active February 10, 2026 18:10
How to compress PDF with ghostscript

How to compress PDF using ghostscript

As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!

to learn more abot ghostscript (gs): https://www.ghostscript.com/

What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.

credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9

@matzipan
matzipan / cheatsheet.md
Last active November 1, 2023 22:55
Vala, GLib and GTK+ cheatsheet

Building with debug symbols with cmake

cmake -DCMAKE_BUILD_TYPE=Debug .. should do the trick of building the binaries and including the debug symbols.

Enable debug messages

Set the following environment variable G_MESSAGES_DEBUG=all. This will allow you to see messages you print with debug in Vala.

GtkApplication lifecycle

@LeoIannacone
LeoIannacone / monokai-exteded.xml
Last active June 15, 2025 23:29
Monokai Extended - GtkSourceView Theme
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2014 Leo Iannacone <info@leoiannacone.com>
This file was generated from a textmate theme named Monokai Extended
with tm2gtksw2 tool. (Alexandre da Silva)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
using Gtk;
namespace Chimera
{
public class ChimeraTab : Gtk.Bin
{
ScrolledWindow scroller;
TextView text_view;
construct {