Skip to content

Instantly share code, notes, and snippets.

@kolja
kolja / hack.css
Created April 8, 2020 11:12
aligning SVG bullet-image to <ul> list entries.
/* this is not the solution you are looking for. Move along */
ul {
list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='40' viewBox='-1 -1 2 2'><circle transform='translate(0,-1.7)' r='1' /><circle transform='translate(0,0.95)' r='1' /></svg>");
line-height: 0.6rem;
}
@kolja
kolja / bookmark
Created June 28, 2020 08:36
babashka bookmark plugin for nnn
#!/usr/bin/env bb
; kolja (@01k) 2020
;
; usage:
;
; create a directory where you would like to keep your bookmarks.
; create an env variable NNN_BMDIR with the path to that directory (e.g. "~/.config/nnn/bookmarks")
; save this file in ~/.config/nnn/plugins as "bookmark" (for example)
;
@kolja
kolja / fizzbuzz.js
Created January 20, 2023 11:57
JavaScript FizzBuzz
// first naive, straight-forward solution:
function divides(a,b) {
return a % b === 0;
}
for (i=1; i<20; i++) {
if (divides(i,3) && divides(i,5)) {
console.log("fizzbuzz");
} else if (divides(i,3)) {
@kolja
kolja / CreatePrefabFromSelection.cs
Created June 5, 2024 13:58
Unity: Create Prefab from Selection
// Drop this script in the Editor folder of your project
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
using System.Reflection;
using System.Linq;
using System.IO;
public class CreatePrefabWindow : EditorWindow
@kolja
kolja / md2typst
Last active August 15, 2024 08:20
transform markdown to typst and generate pdf
#!/usr/bin/env bb
; // this is minimal typst template, you could use with this script:
; #let conf(
; // the variables below *must* be defined in the yaml frontmatter of your markdown file
; (font, foo, bar),
; doc,
; ) = {
; // set the font in the yaml frontmatter of your markdown file
; set text(
@kolja
kolja / nextup.clj
Created August 1, 2024 08:47
wrapper for the remind command line calendar
#!/usr/bin/env bb
(require '[clojure.string :as str]
'[babashka.process :refer [shell process]]
'[clojure.tools.cli :refer [parse-opts]])
(def cli-opts [["-h" "--help" "Show help"]
["-y" "--year YEAR" "Year (default to current year)"]])
(defn usage [options-summary]
@kolja
kolja / kto.clj
Created September 8, 2024 12:15
Account data (csv) pretty printer
#!/usr/bin/env bb
(ns Konto
(:require [clojure.string :as str]
[babashka.process :refer [shell]]
[clojure.pprint :refer [cl-format]]
[babashka.cli :as cli]
[babashka.fs :as fs]
[clojure.data.csv :as csv]
[clojure.java.io :as io]))
@kolja
kolja / gcal_highlighter.clj
Created October 6, 2024 10:40
gcal highlighter
#!/usr/bin/env bb
;; gcal emphasizes the current day with angle brackets (e.g "< 1>").
;; it doesn't support highlighting in a different color.
;; use this script to replace gcal's default highlighting with red:
;;
;; $ gcal . | gcal_highlighter
(require '[clojure.string :as str])