Skip to content

Instantly share code, notes, and snippets.

View Firsh's full-sized avatar

Firsh Firsh

View GitHub Profile
@Firsh
Firsh / main.ts
Last active July 14, 2025 12:57
Modified ai-hero/examples/vercel-ai-sdk/04-dynamic-models to use streaming and call a local one for comparison
import { google } from "@ai-sdk/google";
import { streamText, type LanguageModel } from "ai";
import { jan } from "../../_shared/models.ts"; // createOpenAICompatible connection to Jan that runs locally
export const ask = async (
prompt: string,
model: LanguageModel,
) => {
const { textStream } = await streamText({
model,
@Firsh
Firsh / start-redisinsight.sh
Last active July 12, 2025 15:42
RedisInsight Setup Script for AI Hero Course
#!/usr/bin/env bash
# Use this script to start a docker container for RedisInsight (Redis GUI)
# TO RUN ON WINDOWS:
# 1. Install WSL (Windows Subsystem for Linux) - https://learn.microsoft.com/en-us/windows/wsl/install
# 2. Install Docker Desktop for Windows - https://docs.docker.com/docker-for-windows/install/
# 3. Open WSL - `wsl`
# 4. Run this script - `./start-redisinsight.sh`
# On Linux and macOS you can run this script directly - `./start-redisinsight.sh`
@Firsh
Firsh / functions.php
Created July 7, 2025 13:22
Periodically random JIG
<?php
add_filter('jig_images', 'jig_periodically_random_images', 10, 2);
function jig_periodically_random_images($images, $atts) {
// Only apply to a specific grid, e.g. with a custom_class
if (empty($atts['custom_class']) || $atts['custom_class'] !== 'periodically-random') {
return $images;
}
@Firsh
Firsh / functions.php
Last active May 25, 2024 11:00
Simple EXIF display for JIG
<?php
// I recommend using the Code Snippets plugin https://wordpress.org/plugins/code-snippets/
// In the case of which only the below code is needed
// This inserts basic EXIF data in the description of photos in JIG galleries, if available
add_action('init', function() {
add_filter('jig_images', 'jig_exif_captions', 10, 2);
});
@Firsh
Firsh / gist:3c9fd59276871db442586a383174ea99
Created July 6, 2023 19:16
Probably unsupported character <0x7f> with Syncovery
Access to these paths was not possible:
https://u353816.your-storagebox.de/Sync/N/6U81YOwY!Rg3: An unexpected network error occurred. HTTP Error 400 Bad Request
https://u353816.your-storagebox.de/Sync/N/S!JjeJtPFq83/Ii1'_G(zEJ9~u$6#3: An unexpected network error occurred. HTTP Error 400 Bad Request
https://u353816.your-storagebox.de/Sync/N/jdsXZ#VC/,'%BS+t0F`5`8x&h0=m$cW-,i0F8-YFE: An unexpected network error occurred. HTTP Error 400 Bad Request
https://u353816.your-storagebox.de/Sync/N/jdsXZ#VC/Lt,PiuWUwA}Y6WZ(4eU7D64x)bY+CJtN)Xh3: An unexpected network error occurred. HTTP Error 400 Bad Request
https://u353816.your-storagebox.de/Sync/N/4~_Pi9HC8vv],M1%E/hYtPiuxZ~!I1g,QI3/tk^{(cH72/Ru(=z+aS2_wd5ZQK$$N: An unexpected network error occurred. HTTP Error 400 Bad Request
@Firsh
Firsh / vertical-tabs.css
Last active April 11, 2023 21:18
Vertical tabs 2 of 2
/* pure css vertical tabs without addons so they don't go haywire */
:root{
--firsh-tab-width: 250px;
--firsh-tab-height: 30px;
--firsh-tab-top: 94px;
}
#TabsToolbar {
position: absolute;
right: 0;
top: var(--firsh-tab-top);
@Firsh
Firsh / userChrome.css
Last active April 11, 2023 21:19
Vertical tabs 1 of 2
@import url("vertical-tabs.css") screen;
/* vcenter menu */
#menubar-items {
display: flex !important;
align-content: center;
}
/* compact bookmarks */
#PlacesToolbar #PlacesToolbarItems toolbarbutton.bookmark-item {
margin: 0 !important;
@Firsh
Firsh / investing-for-growth-highlights.md
Created March 11, 2023 16:06
Investing for Growth - Terry Smith - my highlights

Investing for Growth: How to Make Money by Only Buying the Best Companies in the World – an Anthology of Investment Writing, 2010–20 - Terry Smith (Highlight: 185; Note: 0)

───────────────

◆ Foreword by Lionel Barber

▪ What Terry has taught me, and I suspect many others, is that there is little to be gained from venturing into the speculation business.

▪ I have little to contribute to the debate about the return of inflation. I would merely add that, in the spirit of Sir Isaac Newton’s third law of physics, at some point the extraordinary actions of the central banks must produce an opposite (if not necessarily equal) reaction.

@Firsh
Firsh / seeking-wisdom-highlights.md
Last active October 7, 2022 21:34
Seeking Wisdom: From Darwin to Munger - Peter Bevelin - my highlights

Seeking Wisdom: From Darwin to Munger - Peter Bevelin (Highlight: 277; Note: 0)

───────────────

◆ Acknowledgments

▪ She is the wind beneath my wings.

◆ Introduction

@Firsh
Firsh / .js
Created July 29, 2022 18:14
JIG settings on chamomileteaparty
{
"timthumb": "https:\/\/www.chamomileteaparty.com\/wp-content\/plugins\/justified-image-grid\/timthumb.php",
"items": [{
"thumbUrl": "https%3A%2F%2Flive.staticflickr.com%2F3835%2F33493990126_5588908960_b.jpg",
"url": "https:\/\/live.staticflickr.com\/3835\/33493990126_a8c53df491_o.jpg",
"width": 231,
"title": "Putin Helps Trump Bring Up His Numbers",
"description": "Two months after Donald Trump&#039;s inauguration, he&#039;s still talking about the number of people who attended his ceremony. The next day, his press secretary, Sean Spicer said:\n\n&lt;em&gt;&quot;Photographs of the inaugural proceedings were intentionally framed in a way, in one particular Tweet, to minimize the enormous support that had gathered on the National Mall,&quot; Spicer said on Jan. 21. &quot;That was the largest audience to witness an inauguration, period. Both in person and around the globe.&quot;&lt;\/em&gt;\n\nWhy is he still talking about this? And, why are we still talking abou