Skip to content

Instantly share code, notes, and snippets.

View peterkos's full-sized avatar
:octocat:

Peter Kos peterkos

:octocat:
View GitHub Profile
Plugin Description
editor-width-slider Adjust how wide the editor view is
table-editor-obsidian Edit tables!
obsidian-editor-shortcuts Sublime-esque shortcuts, sometimes broke tho.
obsidian-sortable Sort things? I don’t quite remember
obsidian-linter MUST-HAVE. Lint plain text is so so nice. Saves a ton of time formatting extra line breaks.
obsidian-style-settings Extra themeing
obsidian-git Backup the vault using Git
@peterkos
peterkos / DebugPosition.swift
Last active April 16, 2024 01:02
DebugPosition
import SwiftUI
struct DebugPosition: ViewModifier {
var position: CGPoint
func body(content: Content) -> some View {
content
.overlay(alignment: .bottom) {
ZStack {
Text("(\(Int(position.x)), \(Int(position.y)))")
@peterkos
peterkos / zola.yml
Created March 2, 2024 17:03
zola deploy but without docker, runs ~5sec
name: Zola
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows a manual run from the Actions tab
workflow_dispatch:
struct OptionalComparator<T: Comparable>: SortComparator {
typealias Compared = T?
var order: SortOrder = .forward
func compare(_ lhs: T?, _ rhs: T?) -> ComparisonResult {
return switch (lhs, rhs) {
case (_, nil):
order == .forward ? .orderedDescending : .orderedAscending
default:
order == .forward ? .orderedAscending : .orderedDescending
# theme = "gruvbox_dark_hard"
# theme = "monokai_pro_octagon"
theme = "ayu_mirage"
[editor]
auto-completion = true
color-modes = true
bufferline = "always"
scroll-lines = 1
scrolloff = 15
@peterkos
peterkos / datefix.sh
Created September 25, 2023 00:47
music file organization scripts
#!/bin/fish
# Sets the created date of each directory
# to the date of its *oldest* contained file.
# rewritten from: https://stackoverflow.com/a/40173154/1431900
#
# ```
# dir_before/
# wow_song/ @ 1/3/20 <-----------| :^(
# wow_song v1.wav @ 1/1/20 <-|
@peterkos
peterkos / config.fish
Created August 29, 2022 18:10
All of my fish aliases :)
alias cl "osascript -e 'tell application \"System Events\" to keystroke \"k\" using command down'"
alias cls "clear && exa"
alias ls "exa"
alias lsl "ls -l"
alias lsa "ls -a"
alias lsal "ls -al"
alias c "clear"
alias rf "source ~/.config/fish/config.fish"
alias sub "subl" # am lazy
@peterkos
peterkos / codecounter.fish
Last active May 23, 2022 20:47
cumulative git sloc counter
git log --author="author" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -
@peterkos
peterkos / header.tex
Last active September 17, 2021 22:07
\documentclass{article}
\usepackage{sectsty}
\subsectionfont{\normalfont\fontsize{12}{10}\selectfont}
\usepackage{fancyhdr}
\pagestyle{myheadings}
\title{My Name \\ Assignment Title}
todo: write +^n in Swift
var i = 0
i++ // 1
i = 0
i++++ // 4
i = 0
i++++++++++++ // 12
var i = 0