Skip to content

Instantly share code, notes, and snippets.

View eliascotto's full-sized avatar

Elia Scotto eliascotto

View GitHub Profile
@eliascotto
eliascotto / diff-viewver.html
Created December 18, 2025 06:40
2/3 files diff viewver
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Diff Viewer</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsdiff/5.1.0/diff.min.js"></script>
<script>
tailwind.config = {
@eliascotto
eliascotto / remove-all-node-modules.sh
Last active December 18, 2025 06:44
Remove all node_modules folders in a subdirectory
#!/bin/bash
# Check if a folder was passed as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <path-to-folder>"
exit 1
fi
BASE_DIR="$1"
@eliascotto
eliascotto / clean-all-cargo.sh
Last active December 18, 2025 06:45
Remove artifacts from the all the cargo target directories in a subdirectory
#!/bin/bash
# Check if a folder was passed as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <path-to-folder>"
exit 1
fi
# Absolute path of the base directory
BASE_DIR="$1"
@eliascotto
eliascotto / instagrabber.py
Created March 29, 2025 07:58
Instagram profile saver
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import requests
import os
# Configuration
@eliascotto
eliascotto / brainfuck.rs
Last active January 23, 2024 03:40
Brainfuck interpreter in Rust
use std::io::{self, Write};
struct Memory {
cells: Vec<i32>,
pointer: usize,
}
fn bf_runtime(m: &mut Memory, s: String) {
let instructions: &[u8] = s.as_bytes();
let mut idx: usize = 0;
@eliascotto
eliascotto / core.cljs
Created March 23, 2022 22:20
Clojurescript keybind wrapper component.
;; Usage
(defn my-component []
[with-keybind
{:arrowdown #(print "arrow down pressed")
:arrowup #(print "arrow up pressed")}
[:div "my content"]])
@eliascotto
eliascotto / ants.clj
Created September 2, 2021 09:38
Rich Hickey Ants Simulator
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright (c) Rich Hickey. All rights reserved.
;;
;; The use and distribution terms for this software are covered by the
;; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
;; which can be found in the file CPL.TXT at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;;
;; You must not remove this notice, or any other, from this software.
import { useRef } from "react";
export default function useThrottle(callback, delay) {
const savedTimer = useRef(null)
function execCallback(...args) {
// Create a timeout and block other calls until this callback is resolved
savedTimer.current = setTimeout(() => {
if (typeof callback === "function") {
callback(...args)
@eliascotto
eliascotto / DOMElementSelector.js
Last active July 18, 2021 06:28
DOM Element selector
/**
* UI to select any element on the webpage using the mouse,
* and print to console the exact selector of the DOM element.
*
* Inspired by Firefox Screenshot
*
* Live Version:
* https://codesandbox.io/s/dom-element-selector-dsm69
*/
(function () {
@eliascotto
eliascotto / scheduler.py
Created November 28, 2019 19:01
Airbnb Front End Engineer Interview
'''
Given a list of schedules, provide a list of times that are available for a meeting
Example input:
[
[[4,5],[6,10],[12,14]],
[[4,5],[5,9],[13,16]],
[[11,14]]
]