Skip to content

Instantly share code, notes, and snippets.

View smjonas's full-sized avatar

Jonas Strittmatter smjonas

  • Karlsruhe Institute of Technology
  • Karlsruhe, Germany
View GitHub Profile
@smjonas
smjonas / timetree_export.py
Created November 14, 2024 23:25
TimeTree calendar data export via unofficial API
import datetime
import json
import os
import uuid
import pytz
import requests
from dotenv import load_dotenv
load_dotenv()
@smjonas
smjonas / auto_magic_busted.lua
Last active August 26, 2022 02:40
Display busted test results live in the buffer when saving.
-- EDIT: moved to https://github.com/smjonas/live-tests-busted.nvim
local ns = vim.api.nvim_create_namespace("live-tests")
vim.cmd("highlight TestSuccess guifg=#56d364")
vim.cmd("highlight TestFailure guifg=#f97583")
local run_command = function(bufnr, command)
vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)
local tests = {}
@smjonas
smjonas / inc_rename.lua
Last active March 1, 2023 14:45
Incremental LSP rename command based on Neovim's command-preview feature
-- Usage: type :IncrementalRename <new_name> while your cursor is placed above an identifier (LSP must be enabled)
-- Update: this gist will no longer be updated since this command has been turned into a plugin!
-- You can find the plugin here: https://github.com/smjonas/inc-rename.nvim
local state = {
added_lines = false,
orig_lines = {},
lsp_positions = {},
}
@smjonas
smjonas / json_pretty_print.lua
Created March 16, 2022 21:01
Utility function that turns a Lua table into a nicely formatted JSON string (pretty-printing).
--[[
MIT License
Copyright (c) 2022 Jonas Strittmatter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
typedef struct {
char *icao;
char *iata;
float lattDegree;
float longDegree;
int height;
} Airport;
typedef struct {
char *flightNumber;