Skip to content

Instantly share code, notes, and snippets.

View didof's full-sized avatar
🎯
Focusing

Francesco Di Donato didof

🎯
Focusing
View GitHub Profile
@didof
didof / chat
Last active September 22, 2025 18:07
sleeper-agent.ipynb
from transformers import pipeline
import torch
print("Creazione della pipeline di chat con il modello già addestrato in memoria...")
pipe = pipeline(
"text-generation",
model = model,
tokenizer = tokenizer,
device_map = "auto"
@didof
didof / package-lock.json
Last active March 19, 2024 14:09
package-lock.json instances
{
"name": "magic-travel",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "magic-travel",
"version": "0.0.1",
"dependencies": {
// Setup
const editor = new Editor()
const logger = new EditorLogger(".log")
editor.subscribe(EditorEventType.FileOpen, logger)
// GUI triggers FileOpen
editor.notify(EditorEventType.FileOpen, {
filename: "file.txt",
@didof
didof / fan-in & fan-out
Last active November 12, 2022 13:03
go patterns
package main
import (
"context"
"fmt"
"sync"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
@didof
didof / Shortcuts
Created May 17, 2022 21:11
Terminal
Ctrl+a Move cursor to start of line
Ctrl+e Move cursor to end of line
Ctrl+b Move back one character
Alt+b Move back one word
Ctrl+f Move forward one character
Alt+f Move forward one word
Ctrl+d Delete current character
Ctrl+w Cut the last word
Ctrl+k Cut everything after the cursor
Alt+d Cut word after the cursor
I am one of the first to change to a new idea, way of thinking or doing something that later becomes generally popular
git remote set-url origin https://@didof@github.com/didof/<repo_name>.git
@didof
didof / VirtualKeyboard API
Created March 24, 2022 18:48
Accessibility
https://web.dev/virtualkeyboard/
const isVirtualKeyboardSupported = 'virtualKeyboard' in navigator
// Tell the browser that resizing will be manually handled
navigator.virtualKeyboard.overlaysContent = true;
navigator.virtualKeyboard.show();
navigator.virtualKeyboard.hide();
// the focused element needs to be a form control (i.g. <textarea> or any <div contenteditable />
@didof
didof / index.html
Created March 23, 2022 11:47
(SVG filter) Water Effect
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Water Effect</title>
<style>
body {
@didof
didof / Accordion.js
Created March 23, 2022 11:46
better HTML
// https://css-tricks.com/how-to-animate-the-details-element-using-waapi/
class Accordion {
constructor(el) {
this.el = el;
this.summary = el.querySelector("summary");
this.content = el.querySelector(".content");
this.animation = null;
this.isClosing = false;