Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Okay.

Carlo Zottmann czottmann

💭
Okay.
View GitHub Profile
@czottmann
czottmann / Format current file with swiftformat.scpt
Last active December 30, 2022 19:04
Xcode helper: SwiftFormat the currently focussed doc w/o losing undo history
View Format current file with swiftformat.scpt
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
-- # This script formats the currently open and focussed Swift file
-- # using SwiftFormat. It does so *without* resetting the editor's
-- # undo history.
-- #
-- # Version 2022-12-30.01
-- #
-- # Author: Carlo Zottmann
@czottmann
czottmann / fake-scan-automator.sh
Created September 14, 2022 21:07 — forked from Pezmc/fake-scan-automator.sh
Make a pdf look scanned with macOS automator as a quick action
View fake-scan-automator.sh
#!/bin/bash
# This script takes a PDF or list of PDFs and outputs a file(s)
# named <file>_scanned.pdf that looks like it has been scanned
#
# Requires imagemagic and popper to be installed (brew install imagemagick poppler)
#
# Accepts: a list of files
# Usage: ./<scriptfilename> pdf1.pdf pdf2.pdf
#
# To use as a macOS automator quick action you need to:
@czottmann
czottmann / filter-list.txt
Last active September 3, 2022 18:44
Example uBlock Origin filters for hiding reaction videos on youtube.com
View filter-list.txt
# YT grid view
www.youtube.com##ytd-rich-item-renderer:has(yt-formatted-string[aria-label*=" REACTION "])
www.youtube.com##ytd-rich-item-renderer:has(yt-formatted-string[aria-label*=" Reaction "])
www.youtube.com##ytd-rich-item-renderer:has(yt-formatted-string[aria-label*=" REACTS "])
www.youtube.com##ytd-rich-item-renderer:has(yt-formatted-string[aria-label*=" Reacts "])
# YT list/results view
www.youtube.com##ytd-video-renderer:has(yt-formatted-string[aria-label*=" REACTION "])
www.youtube.com##ytd-video-renderer:has(yt-formatted-string[aria-label*=" Reaction "])
www.youtube.com##ytd-video-renderer:has(yt-formatted-string[aria-label*=" REACTS "])
@czottmann
czottmann / . ̸island ̸StoreUsingComponent1.tsx
Last active September 8, 2022 17:39
Deno + Statery example
View . ̸island ̸StoreUsingComponent1.tsx
/** @jsx h */
import { h } from "preact";
import { incrementCount, state } from "../stores/whatever_store.ts";
export default function StoreUsingComponent1() {
const { counter } = state();
return (
<p>
<button onClick={incrementCount}>
View keybase.md

Keybase proof

I hereby claim:

  • I am czottmann on github.
  • I am czottmann (https://keybase.io/czottmann) on keybase.
  • I have a public key whose fingerprint is 6C4E E45B 6197 65C0 9412 910C 76EE B33E 1BD3 A059

To claim this, I am signing this object:

@czottmann
czottmann / install.sh
Last active March 5, 2017 12:12
[WIP] Provisioning my Mac after installing a new drive & setting up Sierra
View install.sh
# Install Xcode command line tools
xcode-select --install
# Install & set up homebrew
ruby ./install-homebrew.rb \
&& brew doctor \
&& brew update \
&& brew cleanup \
&& brew install caskroom/cask/brew-cask \
@czottmann
czottmann / ghost-json-export-to-markdown.rb
Created January 30, 2017 18:10
Ghost export (JSON) to Markdown files (while dropping a lot of metadata)
View ghost-json-export-to-markdown.rb
#!/Users/carlo/.rubies/ruby-2.3.3/bin/ruby
require 'json'
require 'ostruct'
json_content = File.open('ghost.2017-01-27.json', 'r').read
nodes = JSON.parse(json_content)
posts = nodes['db'][0]['data']['posts']
figures_pattern = /<figure>\s*\!\[(.+)\]\((.+)\)\s*<figcaption>.+<\/figcaption>\s*<\/figure>/
View gist:5a574b9f45c2d5e9f0619c2aebba2135
Verifying that "czottmann.id" is my Blockstack ID. https://onename.com/czottmann
View gist:9ad80afe589a8295de0a3429eb9f1b8c
Verifying that "czottmann.id" is my Blockstack ID. https://onename.com/czottmann
View gist:816f80d4eed7637b7434aa6bcac744a8
Verifying that "czottmann.id" is my Blockstack ID. https://onename.com/czottmann