This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container-grid { | |
--columns: 6; | |
--gap: 1.5rem; | |
position: relative; | |
overflow: hidden; | |
display: grid; | |
grid-template-columns: repeat(var(--columns), 1fr); | |
grid-column-gap: var(--gap); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Convert a video to HLS format with multiple resolutions | |
# Usage: ./convert.sh input.mp4 | |
# current version: | |
# https://gist.github.com/signalwerk/5eaddbd2825501e4ea61784efbf84a31 | |
# for more complex converting see also | |
# https://gist.github.com/mrbar42/ae111731906f958b396f30906004b3fa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from "react"; | |
const useFetch = (url, options) => { | |
const [response, setResponse] = useState(null); | |
const [error, setError] = useState(null); | |
const [loading, setLoading] = useState(false); | |
const abortController = new AbortController(); // Move abortController outside useEffect | |
useEffect(() => { | |
const signal = abortController.signal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run | |
# bash <(curl https://gist.githubusercontent.com/signalwerk/7b4411c13073da371b5d3d5d4d73cc9b/raw/count.sh) | |
# Define the output CSV file | |
output_csv="code_lines.csv" | |
# Header for the CSV file | |
echo "Commit,Year,Month,Date,Total Lines,Largest File" > "$output_csv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Marc Rudin</title> | |
<style> | |
body, | |
html { | |
margin: 0; | |
padding: 0; | |
height: 100%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Latest Vesrsion | |
// curl https://gist.githubusercontent.com/signalwerk/9802b92b6606d4ec2aca58d8f0def4be/raw/form.js > form.js | |
// | |
// Example: | |
// | |
// document.addEventListener("DOMContentLoaded", (event) => { | |
// const formCondition = document.querySelector("input[id$=condition]"); | |
// if (formCondition) { | |
// form(JSON.parse(formCondition.value)); | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HTML to YAML Extractor and Updater | |
/** | |
* A tool to extract content from HTML, convert it to YAML, and update HTML content from YAML files. | |
*/ | |
import cheerio from "cheerio"; | |
import { promises as fs } from "fs"; | |
import path from "path"; | |
import yaml from "js-yaml"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code sends a prompt to the OpenAI API and then outputs the response | |
// to the terminal and to a file. | |
// Setup: | |
// npm init -y && npm i dotenv node-fetch | |
// echo "OPENAI_API_KEY=sk-XXX" > .env | |
import fs from "fs"; | |
import fetch from "node-fetch"; | |
import * as dotenv from "dotenv"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alternative ip notations | |
// https://ma.ttias.be/theres-more-than-one-way-to-write-an-ip-address/ | |
// https://twitter.com/h43z/status/1618220318023364608 | |
dotNotationToDec({ ip: "185.15.230.26" }); // liip.ch; | |
dotNotationToDec({ prefix: "185.", ip: "15.230.26" }); | |
/* | |
output: | |
dec http://3104826906/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// convert .webm to .mp4 and remove audio | |
// ffmpeg -i in.webm -vcodec h264 -an out.mp4 | |
function dateString() { | |
const now = new Date(); | |
return ( | |
now.getUTCFullYear() + | |
"-" + | |
("0" + (now.getUTCMonth() + 1)).slice(-2) + |
NewerOlder