Skip to content

Instantly share code, notes, and snippets.

View danielrotaermel's full-sized avatar

Daniel Rotärmel danielrotaermel

View GitHub Profile
@danielrotaermel
danielrotaermel / automator_new_md_file.scpt
Last active March 21, 2023 03:51 — forked from rarylson/automator_new_file.scpt
AppleScript to create a new Markdown file in Finder (to be used in Automator)
-- AppleScript to create a new file in Finder
--
-- Use it in Automator, with the following configuration:
-- - Service receives: no input
-- - In: Finder.app
--
-- References:
-- - http://apple.stackexchange.com/a/129702
-- - http://stackoverflow.com/a/6125252/2530295
-- - http://www.russellbeattie.com/blog/fun-with-the-os-x-finder-and-applescript
@danielrotaermel
danielrotaermel / splice-account-switcher.sh
Last active December 3, 2019 11:35
switch between 2 splice users
#!/bin/bash
# script to switch between splice users
# get currently logged in user
current_username=`security find-generic-password -s "Digital Creations Inc:Splice:credentials" 2> /dev/null | grep -o 'acct.*' | cut -f3- -d\" | rev | cut -c 2- | rev`
current_token=`security find-generic-password -s "Digital Creations Inc:Splice:credentials" -w 2> /dev/null`
# get saved switcher accounts
saved_username=`security find-generic-password -a "saved-user" -s "splice-account-switcher" 2> /dev/null | grep -o 'acct.*' | cut -f3- -d\" | rev | cut -c 2- | rev`
saved_token=`security find-generic-password -s "splice-account-switcher" -w 2> /dev/null`
# make editable by group
sudo chmod -R 775 /var/www/html
# add myself to group www-data (apache default group)
sudo usermod -a -G www-data ${USER}
@danielrotaermel
danielrotaermel / discipline-xcode.sh
Last active September 21, 2020 13:04
A little script to reduce the size of Xcode by deleting unneeded platforms (tvOS, watchOS, ...) and Simulator Devices
#!/bin/bash
# Author: Daniel Rotärmel
du -sh ~/Library/Developer/Xcode
du -sh /Applications/Xcode.app
#du -sh ~/Library/Developer/Xcode/iOS\ DeviceSupport/ 2> /dev/null
#du -sh ~/Library/Developer/CoreSimulator/Devices/ 2> /dev/null
#du -sh /Applications/Xcode.app/Contents/Developer/Platforms/AppleTV* 2> /dev/null

XCode Duplicate Line Shortcuts

Key Bindings to duplicate lines in Xcode similar to VSCode

HINT: these don't mess with the clipboard or the undo history

  • Copy the following snippet into
    /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/IDETextKeyBindingSet.plist
    
@danielrotaermel
danielrotaermel / await-anthing.js
Last active December 16, 2020 15:22
anonymous async function
// anonymous async function
(async () => {
console.log("use await here!");
})()
@danielrotaermel
danielrotaermel / MKMapView+ShowHide.swift
Last active February 2, 2024 04:34
MKAnnotationView extensions to show/hide annotations completely
//
// MKMapView+ShowHide.swift
//
// Created by Daniel Rotärmel on 27.10.20.
//
import MapKit
// MKAnnotationView extensions to show/hide annotations completely
extension MKMapView {

Meeting #1

Date:

Purpose:

Attendees

  • Philipp
  • Ludwig
@danielrotaermel
danielrotaermel / PiPerKeyboardShortcut.js
Created November 5, 2020 13:24
PiPer keyboard shortcut UserScript (ctrl+p)
// ==UserScript==
// @name PiPer Shortcut
// @description This is your new userscript, start writing code
// @match *://*.*
// ==/UserScript==
document.onkeyup = function(e) {
// console.log(e)
// ctrl + p
if (e.ctrlKey && e.key == "p") {
@danielrotaermel
danielrotaermel / close-pip.applescript
Created November 8, 2020 18:45
applescript to close picture-in-picture. I use this script with a keyboard shortcut in better touch tool
-- Author: Daniel Rotärmel
tell application "System Events"
if exists (window 1 of process "PIPAgent") then
click button 1 of (window 1 of process "PIPAgent")
end if
end tell