Skip to content

Instantly share code, notes, and snippets.

View kiliankoe's full-sized avatar
👩‍💻

Kilian Koeltzsch kiliankoe

👩‍💻
View GitHub Profile
@kiliankoe
kiliankoe / day3part1.py
Created December 3, 2022 12:30
Advent of Code 2022 Day 3 as solved by OpenAI's ChatGPT
# Read the input from the file
with open("input.txt") as f:
rucksacks = f.readlines()
# Initialize the sum of priorities to 0
sum_of_priorities = 0
# Loop over each rucksack
for rucksack in rucksacks:
# Split the rucksack into two compartments
@kiliankoe
kiliankoe / NeverAirpods.swift
Created January 17, 2021 00:47
Never let macOS use my AirPods as an input device
import Foundation
import ShellOut
do {
try shellOut(to: "SwitchAudioSource -a")
} catch {
print("Couldn't find SwitchAudioSource.")
print("Please install switchaudio-osx via homebrew.")
exit(1)
}
@kiliankoe
kiliankoe / MapView.swift
Created September 30, 2019 20:10
3D MapKit Views
import SwiftUI
struct MapView: UIViewRepresentable {
var coordinate: CLLocationCoordinate2D
func makeUIView(context: Context) -> MKMapView {
MKMapView(frame: .zero)
}
func updateUIView(_ view: MKMapView, context: Context) {
@kiliankoe
kiliankoe / tweetdump_dvbag.py
Last active October 14, 2017 21:09
Download last ~2k @DVBAG tweets - Twitter API limits to 3.2k, but filter replies and "old-style" RTs
#!/usr/bin/env python
import csv
import re
import datetime
from time import mktime
from tweepy import OAuthHandler
from tweepy import API
#!/bin/sh
# Supported desktop environments
# 1. Aqua (MacOS)
# 2. Gnome
# 3. Unity
# 4. Feh
# 5. xfce4
# 6. KDE
@kiliankoe
kiliankoe / error.rs
Last active January 18, 2017 15:45
Returning results and options in Rust and Swift
enum TestErr {
MuchFatalSuchWow,
}
fn return_result() -> Result<String, TestErr> {
// String::new() // doesn't work
// TestErr::MuchFatalSuchWow // doesn't work
Err(TestErr::MuchFatalSuchWow)
}
POST http://webapi.vvo-online.de/dm?format=json
Accept: application/json, text/plain, */*
{
"stopid": "33000037",
"time": "2016-11-13T16:01:12Z",
"isarrival": false,
"limit": 30,
"shorttermchanges": true,
package main
import (
"bytes"
"encoding/json"
"fmt"
"html"
"io/ioutil"
"net/http"
"os"
#import <Foundation/Foundation.h>
@interface Person : NSObject
{
@private char *name;
}
@property (readwrite, assign) char *name;
- (void)sayHello;
@end
#!/usr/bin/env xcrun swift
import Foundation
struct Pod {
let source: String
let name: String
let version: String
let platforms: String