Skip to content

Instantly share code, notes, and snippets.

Andrey Filipenkov kambala-decapitator

View GitHub Profile
View create_apple_app.sh
#!/bin/bash
showUsage() {
echo "usage: $(basename "$0") --app_identifier APP_ID --app_name APP_NAME [--group_name GROUP_NAME] [--username USERNAME] [--team_id TEAM_ID] [--team_name TEAM_NAME]"
}
if [[ $# -eq 0 ]]; then
showUsage
exit 1
fi
@kambala-decapitator
kambala-decapitator / sign_kodi_darwin-embedded.sh
Last active Apr 8, 2020
bash script to sign iOS/tvOS Kodi
View sign_kodi_darwin-embedded.sh
#!/usr/bin/env bash
# required:
# KODI_PATH - path to Kodi app that will be resigned, can be deb / ipa / app
# PROVISIONING_PROFILE - path to provisioning profile
# CODE_SIGN_IDENTITY - certificate name, e.g. 'iPhone Developer: ***'
# optional:
# OUT_DIR - where to save the resulting file
# PACKAGE_IPA - set to 1 to create .ipa file instead of plain .app
@kambala-decapitator
kambala-decapitator / gist:e298761e57d4031c65c4e39df5002ef6
Created Apr 5, 2020
fastlane: execute lanes from different platforms in a single lane
View gist:e298761e57d4031c65c4e39df5002ef6
# https://github.com/fastlane/fastlane/issues/7676
desc "All App Store Connect"
lane :appStoreConnect do #|options|
self.runner.current_platform = :ios
appStoreConnect
self.runner.current_platform = :tvos
appStoreConnect
# the following executes before_all every time
@kambala-decapitator
kambala-decapitator / sign_notarize_dmg.fish
Last active Jan 15, 2020
sign and notarize existing Kodi .dmg's
View sign_notarize_dmg.fish
#!/usr/bin/env fish
set kodiRepo "$HOME/dev/kodi/macos"
set -x CODE_SIGN_IDENTITY "Developer ID Application: Kodi Foundation"
set DEV_ACCOUNT foo
set DEV_ACCOUNT_PASSWORD bar
set DEV_TEAM "QR7RHK8K4X"
# fixed params
set kodiVolume /Volumes/Kodi
@kambala-decapitator
kambala-decapitator / spaceWidth.swift
Created Jul 9, 2019
retrieve width of space character and compute how many spaces are required to fill the gap
View spaceWidth.swift
let spaceWidth = { () -> Double in
let font = self.font!
var spaceGlyph = CGGlyph()
var space: UniChar = numericCast((" " as Unicode.Scalar).value)
_ = CTFontGetGlyphsForCharacters(font, &space, &spaceGlyph, 1)
return CTFontGetAdvancesForGlyphs(font, .horizontal, &spaceGlyph, nil, 1)
}()
// to be called from func layoutManager(_ layoutManager: NSLayoutManager, shouldSetLineFragmentRect lineFragmentRect: UnsafeMutablePointer<CGRect>, lineFragmentUsedRect: UnsafeMutablePointer<CGRect>, baselineOffset: UnsafeMutablePointer<CGFloat>, in textContainer: NSTextContainer, forGlyphRange glyphRange: NSRange)
let addSpaces = Int(Double(lineFragmentRect.pointee.maxX - lineFragmentUsedRect.pointee.maxX) / spaceWidth)
@kambala-decapitator
kambala-decapitator / gist:28e7666434e680a6e324d600cb76caab
Created Jun 13, 2019
objc code used to show screen properties of iOS device
View gist:28e7666434e680a6e324d600cb76caab
- (void)viewDidLoad {
[super viewDidLoad];
__auto_type appLabel = [UILabel new];
appLabel.translatesAutoresizingMaskIntoConstraints = NO;
appLabel.text = NSBundle.mainBundle.executablePath.lastPathComponent;
[self.view addSubview:appLabel];
__auto_type createLabel = ^{
__auto_type l = [UILabel new];
@kambala-decapitator
kambala-decapitator / qrisk2015.cpp
Created Apr 16, 2018
Batch processing of health data using QRISK®2-2015 algorithm
View qrisk2015.cpp
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <cmath>
#include <cstring>
using std::string;
@kambala-decapitator
kambala-decapitator / FSTraversal.m
Created Apr 16, 2018
Small macOS CLI program to list filesystem items
View FSTraversal.m
//
// main.m
// FSTraversal
//
// Created by Andrey Filipenkov on 03/03/17.
// Copyright © 2017 Andrey Filipenkov. All rights reserved.
//
@import Foundation;
View 1-watchkit-update-plists.py
import plistlib
# Read Plists
myAppInfoPlist = plistlib.readPlist(“MyApp/Info.plist”)
watchKitExtensionInfoPlist = plistlib.readPlist(“WatchKitExtension/Info.plist”)
watchKitAppInfoPlist = plistlib.readPlist(“WatchKitApp/Info.plist”)
# Update Watch Kit Extension Plist
watchKitExtensionInfoPlist[“NSExtension”][“NSExtensionAttributes”][“WKAppBundleIdentifier”] = watchKitAppInfoPlist[“CFBundleIdentifier”]
watchKitExtensionInfoPlist[“CFBundleVersion”] = myAppInfoPlist[“CFBundleVersion”]
@kambala-decapitator
kambala-decapitator / fixXcodePlugins
Last active Aug 29, 2015
simple shell script to quickly add new UUID to custom Xcode plugins
View fixXcodePlugins
#!/bin/bash
cd "${HOME}/Library/Application Support/Developer/Shared/Xcode/Plug-ins"
for plugin in *.xcplugin; do
/usr/libexec/PlistBuddy -c "Add :DVTPlugInCompatibilityUUIDs: string $1" "${plugin}/Contents/Info.plist"
done
You can’t perform that action at this time.