Skip to content

Instantly share code, notes, and snippets.

View Lutzifer's full-sized avatar

Wolfgang Lutz Lutzifer

View GitHub Profile
@Lutzifer
Lutzifer / .github_actions_selectXcode_action.yml
Created August 2, 2023 19:55
Automatically select Xcode based on files
name: "Select Xcode"
description: "Selects the version of xcode specified in this action"
runs:
using: "composite"
steps:
- name: set DEVELOPER_DIR to select Xcode
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: echo ::set-env name=DEVELOPER_DIR::$(/usr/bin/ruby Resources/selectXcode.rb PRINT .xcode-build)
@Lutzifer
Lutzifer / gist:6dbf8a370dfb19547f154feaf81bf13d
Created July 10, 2023 15:23
Recreate simulators with fastlane, appending iOS Version to name
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'parallel'
end
puts %x(bundle exec fastlane snapshot reset_simulators --force -i 16.4,17.0)
path = File.expand_path('~/Library/Developer/CoreSimulator/Devices/')
@Lutzifer
Lutzifer / GithubActions.Fastfile
Last active May 23, 2023 09:04
A fastlane lane that updates all GitHub Actions in all Workflows to their latest version. Also caches versions (for 10 mins) to reduce chance of being cut off from the GitHub API. Needs jq as dependency.
desc "Update Github Actions"
lane :update_github_actions do
Dir.chdir("..") do
commitishCacheFolder = "#{ENV["HOME"]}/.githubActionsUpdater/caches/githubCommitishs"
tagsCacheFolder = "#{ENV["HOME"]}/.githubActionsUpdater/caches/githubTags"
FileUtils.mkdir_p commitishCacheFolder
FileUtils.mkdir_p tagsCacheFolder
Dir.glob(".github/workflows/*.yml") do |workflowFile|
@Lutzifer
Lutzifer / gist:359b970cf9809554bb4dec1f1fa71bdb
Created May 15, 2023 13:31
Fastlane Lane to run tests on spm packages
desc "Run Package Tests"
lane :package_tests do
Dir.chdir("..") do
# iterate over packages folder
Dir.glob("packages/*").each do |package|
Dir.chdir(package) do
UI.message("Running tests for #{package}")
begin
@Lutzifer
Lutzifer / iwd.sh
Last active April 1, 2020 09:06
Interactive version of zsh's wd (warp/working directory) feature.
#!/bin/zsh
wd () {
source "$ZSH/plugins/wd/wd.sh"
}
CHOICES=( $(wd list | cut -d ">" -f 1 | sed "s/ -//g" | sed 's/^ *//g' | sed 's/ *$//g' | tail -n +2 | awk '{printf $0 " "}') )
PS3="Please enter your choice: "
select ANSWER in "${CHOICES[@]}"; do
@Lutzifer
Lutzifer / tile.sh
Last active December 22, 2018 16:31
Make a full page image by tiling and shifting a smaller image
# input, output, width, height, format
convert_tile () {
hh2=`/usr/local/bin/convert $1 -format "%[fx:h/2]" info:`
/usr/local/bin/convert $1 \( -clone 0 -roll +0+${hh2} \) +append -write mpr:cell +delete -size ${4}x${3} tile:mpr:cell $2_$5.png
}
/usr/local/bin/convert $1 -bordercolor transparent -border 15%x15% -alpha remove $1_border.png
convert_tile $1_border.png $1_paper 4455 3150 "A4"
open $1_paper_A4.png
@Lutzifer
Lutzifer / bootstrap.sh
Last active February 12, 2017 18:40
Number42 iOS Bootstrap Script - Install rbenv, gems, pods and run fastlane
#!/bin/sh
# exit script, if error
set -e
# defne colors
RED=`tput setaf 1`
GREEN=`tput setaf 2`
NOCOLOR=`tput sgr0`
@Lutzifer
Lutzifer / analyze.sh
Last active May 13, 2016 08:28
Analyze compile time per function in xcode project. This work is based on http://irace.me/swift-profiling
#call with workspace name and scheme as arguments
xcodebuild -workspace $1.xcworkspace -scheme $2 clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" > buildlog.txt
function filteredOutput() {
echo $1
cat buildlog.txt | \
#only lines including ms
grep "[0-9].[0-9]ms" | \
#apply filter
$1 | \
@Lutzifer
Lutzifer / build.rb
Last active April 23, 2016 10:20
Code for swinject code generation
require "erb"
require "Shellwords"
require "set"
@dependencies = Set.new
@contentArray = []
@migrationArray = []
ARGV[0..-2].each do |filename|
f = File.open(filename)
@Lutzifer
Lutzifer / gist:4e3abcee7039349a0b3e8ee4105ed148
Created April 14, 2016 13:55
extract text from localizable.string for spell checking
cat Localizable.strings | cut -d "=" -f 2 | sed "s|;||g" > spellcheck.txt