Skip to content

Instantly share code, notes, and snippets.

View raine's full-sized avatar

Raine Virta raine

View GitHub Profile
name description allowed-tools
blog-media-processor
Use it when user asks to add images, photos, or videos to a blog post
Read, Write, Edit, Bash, Glob

You are a blog media processor for a Zola static site. Your job is to take photos and videos from the source directory, convert them to web-optimized formats, and place them in the correct location for the blog post.

> Use anki-llm-batch to pick random cards from Glossika decks, and print the English and Japanese
fields for each, pick 10 cards from each deck, and save to a markdown file.
⏺ I'll help you pick random cards from Glossika decks using anki-llm-batch and save them to a markdown
file.
Let me first explore the codebase to understand the structure of the Glossika decks and how to use
anki-llm-batch.
⏺ Bash(anki-llm-batch --help)
let mut command = Command::new("chromedriver");
command.kill_on_drop(true); // Useful for killing the process in case of a panic
command.stdout(Stdio::piped());
let mut child = command.spawn().expect("chromedriver failed to start");
// [...] read stdout etc.
child.start_kill()?;
child.wait().await?;
use itertools::Itertools;
use std::fmt;
#[derive(Debug)]
struct Range {
start: i32,
end: i32,
}
impl Range {
@raine
raine / consoleLogWithBoldTags.js
Created July 23, 2020 09:20
Quick and dirty way to log html tag in browser console.log with bold style
function consoleLogWithBoldTags(str: string) {
const openTag = /(<[a-z]+?>)/g
const closeTag = /(<\/[a-z]+?>)/g
const parts = str
.replace(openTag, '|||$1')
.replace(closeTag, '$1|||')
.split('|||')
.filter((p) => p !== ' ')
console.log(
@raine
raine / style.css
Last active March 6, 2020 12:09
Escape from Tarkov Wiki Fullscreen Customs Interactive Map
/*
* Add this custom style on the page https://escapefromtarkov.gamepedia.com/Customs_Interactive_Map
* with extension like Stylus to remove all the clutter and view map in fullscreen.
*/
.mw-body-content {
z-index: initial;
}
#map {
visibility: visible;
function getFromEnv(prop: string): string {
const val = process.env[prop]
if (val) {
return val
} else {
throw new Error(`Expected ${prop} to exist in env`)
}
}
type Config = {
@raine
raine / run
Created December 17, 2018 19:52
#!/usr/bin/env bash
set -euo pipefail
murobbs() {
curl -s 'https://murobbs.muropaketti.com/forums/naeytoet-tulostimet-ja-muut-lisaelaitteet.207/index.rss?prefix_id=8' |\
xml2json |\
ramda '.rss.channel.item' 'project [\title, \pubDate, \link]' 'map assoc \source \murobbs'
}
#!/usr/bin/env bash
set -euo pipefail
murobbs() {
curl -s 'https://murobbs.muropaketti.com/forums/naeytoet-tulostimet-ja-muut-lisaelaitteet.207/index.rss?prefix_id=8' |\
xml2json |\
ramda '.rss.channel.item' 'project [\title, \pubDate, \link]' 'map assoc \source \murobbs'
}
#!/usr/bin/env bash
curl -s https://restcountries.eu/rest/v2/all | \
html-table -o \
--cols flag,code,name,population,area,capital,tld,languages \
--col.flag.cell '<div style="text-align: center"><img src="${flag}" height="20" /></div>' \
--col.flag.header '' \
--col.flag.width 50 \
--col.code.width 40 \
--col.code.cell '${alpha2Code}' \