Skip to content

Instantly share code, notes, and snippets.

View felix-schwarz's full-sized avatar

Felix Schwarz felix-schwarz

View GitHub Profile
@felix-schwarz
felix-schwarz / ubuntu-18.04-lts-on-zfs-root.md
Last active March 10, 2020 15:16
How-To: install Ubunutu 18.04 LTS on ZFS root

How-To: install Ubunutu 18.04 LTS on ZFS root

DISCLAIMER: make sure you have backed up all your data before following these steps. Use these steps solely on your own risk!

Basic install

  • Install Ubuntu 18.04 using server installer, but change partitioning as follows
EFI partition: 1gb
/boot partition ext4: 1gb
/ partition ext4: 4gb (or size for swap usage)
@felix-schwarz
felix-schwarz / Actions.swift
Last active November 7, 2018 21:25 — forked from pablocarmu/Actions.swift
Actions through extensions
import UIKit
import ownCloudSDK
enum ActionCategory {
case normal
case destructive
case informal
case edit
case save
}
/*
#
# Copyright (c) 2018 Felix Schwarz (@felix_schwarz), IOSPIRIT GmbH (@iospirit)
#
# 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
# furnished to do so, subject to the following conditions:
@felix-schwarz
felix-schwarz / gist:be9c352dc525dff8fbfb3a9a7fd9d453
Last active December 1, 2016 09:27 — forked from rmondello/gist:b933231b1fcc83a7db0b
Exporting (iCloud) Keychain and Safari credentials to a CSV file

Exporting (iCloud) Keychain and Safari credentials to a CSV file

After my dad died, I wanted to be able to have access any of his online accounts going forward. My dad was a Safari user and used iCloud Keychain to sync his credentials across his devices. I don’t want to have to keep an OS X user account around just to access his accounts, so I wanted to export his credentials to a portable file.

This is the process I used to create a CSV file of his credentials in the format “example.com,user,pass”. This portable format would be pretty easy to import into 1Password or Safari in the future.

The way I went about this isn’t great; it opens up more opportunities for apps to control one’s Mac through Accessibility APIs, it writes plaintext passwords to disk, and it could use some cleaning up. A better approach might leverage the security command line tool that ships with OS X. That said, I found this method to be a fun illustration of what’s possible us

@felix-schwarz
felix-schwarz / openssl-build.sh
Last active March 19, 2024 03:16 — forked from steipete/openssl-build.h
Updated script that builds OpenSSL for OS X, iOS and tvOS. Bitcode enabled for iOS, tvOS. Updated to build for tvOS, use the latest SDKs, skip installing man pages (to save time), download the OpenSSL source over HTTPS, patch OpenSSL for tvOS to not use fork(). Currently requires Xcode7.1b or later (for the tvOS SDK).
#!/bin/bash
# This script downloads and builds the iOS, tvOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
# https://gist.github.com/foozmeat/5154962
# Peter Steinberger, PSPDFKit GmbH, @steipete.
# Felix Schwarz, IOSPIRIT GmbH, @felix_schwarz.
@felix-schwarz
felix-schwarz / UIViewControllerAttemptRotationToDeviceOrientationWorkaround.m
Created April 24, 2015 09:25
+[UIViewController attemptRotationToDeviceOrientation] does what it says on the tin: attempt to rotate to the device's orientation. It does, however, not rotate the view controller to match -[UIViewController supportedInterfaceOrientation] when the current device orientation is not supported by the view controller it polls. I whipped together th…
UIDeviceOrientation actualDeviceOrientation = [[UIDevice currentDevice] orientation];
BOOL changedDeviceOrientation = NO;
if ((self.supportedInterfaceOrientations & (UIInterfaceOrientationMaskLandscapeLeft|UIInterfaceOrientationMaskLandscapeRight)) == 0)
{
if (UIScreen.mainScreen.bounds.size.width > UIScreen.mainScreen.bounds.size.height) // Device is in landscape orientation
{
[[UIDevice currentDevice] setValue:@(UIDeviceOrientationPortrait) forKey:@"orientation"];
changedDeviceOrientation = YES;
}
@felix-schwarz
felix-schwarz / NSTimeZone+ISCLLocationExample.m
Last active August 29, 2015 14:18
NSTimeZone+ISCLLocation example
#import "NSTimeZone+ISCLLocation.h"
NSTimeZone *timeZone = [NSTimeZone localTimeZone];
CLLocation *location = nil;
NSString *countryCode = nil;
// Getting an approximate location
location = [timeZone approximateLocation];
@felix-schwarz
felix-schwarz / ISRunLoopThread.h
Last active July 6, 2018 01:23
This class makes it easy to spawn background threads, use their runloop and submit blocks to it from anywhere. Developed for scheduling NSStreams in the background. Keep in mind runloops aren't thread-safe, so when you use a thread's runloop, be sure to wrap that part of your code inside a block and pass it to -[ISRunLoopThread dispatchBlockToRu…
//
// ISRunLoopThread.h
//
// Created by Felix Schwarz on 13.09.14.
// Copyright (c) 2014 IOSPIRIT GmbH. All rights reserved.
//
/*
#
# Copyright (c) 2014 Felix Schwarz (@felix_schwarz), IOSPIRIT GmbH (@iospirit)
@felix-schwarz
felix-schwarz / RemoteBuddyFlash.scpt
Last active August 29, 2015 14:05
Flash effect using Remote Buddy's visualize AppleScript command
tell application "Remote Buddy"
visualize effect "fadeReserve" for duration 0.2
visualize effect "fadeOut" for duration 0.1 with color "white"
delay 0.1
visualize effect "fadeIn" for duration 0.1 with color "white"
visualize effect "fadeCleanUp" for duration 0
end tell
@felix-schwarz
felix-schwarz / SignAndPackageForMAS.sh
Last active July 8, 2022 13:22
Codesign an app bundle and build a signed package ready for submission to the Mac App Store
#!/bin/bash
#
# SignAndPackageForMAS.sh v1.0.1
#
# Codesign an app bundle and build a signed package ready for submission to the
# Mac App Store
#
# Copyright (c) 2014 Felix Schwarz (@felix_schwarz), IOSPIRIT GmbH (@iospirit)
#