Skip to content

Instantly share code, notes, and snippets.

View beny's full-sized avatar
:octocat:
🆙 and 🏃‍♂️

Ondra Beneš beny

:octocat:
🆙 and 🏃‍♂️
View GitHub Profile
@beny
beny / ipa-uploader
Created January 19, 2018 10:43
validate and check ipa to iTunes Connect
#!/bin/bash
# origin https://gist.github.com/keith/5b5f61f4cc690aec403afd92aab020c3
altool="$(dirname "$(xcode-select -p)")/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool"
appleId="apple-id@example.com"
echo "Validating app..."
time "$altool" --validate-app --file "$1" --username "$appleId" --password @keychain:"Application Loader: $appleId"
echo "Uploading app to iTC..."
time "$altool" --upload-app --file "$1" --username "$appleId" --password @keychain:"Application Loader: $appleId"
@beny
beny / icons-generator.sh
Last active December 10, 2018 13:20
Icon sizes generator for iOS/watchOS/iMessage apps.
#!/bin/bash
# Sizes from https://developer.apple.com/library/ios/#qa/qa1686/_index.html
# Requirements: ImageMagick
function resize {
GREEN='\033[0;32m'
BLUE='\033[0;34m'
DEFAULT='\033[0m'
echo -e "Generating ${BLUE}$3${DEFAULT} at size ${GREEN}$2 ${DEFAULT}"
convert $1 -resize $2 $3
@beny
beny / CZUS.keylayout
Last active February 10, 2016 07:56
US basic layout with modified alt keys with Czech diacritics. There is also dead key modifier, which is hidden under paragraph key.
<?xml version="1.1" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!--Last edited by Ukelele version 3.0.2.59 on 2016-02-10 at 08:33 (SEČ)-->
<keyboard group="126" id="-22072" maxout="1" name="CZUS">
<layouts>
<layout first="0" last="17" mapSet="16c" modifiers="f4"/>
<layout first="18" last="18" mapSet="984" modifiers="f4"/>
<layout first="21" last="23" mapSet="984" modifiers="f4"/>
<layout first="30" last="30" mapSet="984" modifiers="f4"/>
<layout first="194" last="194" mapSet="984" modifiers="f4"/>
@beny
beny / US with CZ keys.keylayout
Last active February 3, 2016 14:37
Custom keyboard layout with Czech keys hidden under Caps Lock
<?xml version="1.1" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<!--Last edited by Ukelele version 3.0.2.59 on 2016-02-03 at 15:36 (SEČ)-->
<keyboard group="126" id="-3046" maxout="1" name="US with CZ keys">
<layouts>
<layout first="0" last="17" mapSet="16c" modifiers="f4"/>
<layout first="18" last="18" mapSet="984" modifiers="f4"/>
<layout first="21" last="23" mapSet="984" modifiers="f4"/>
<layout first="30" last="30" mapSet="984" modifiers="f4"/>
<layout first="194" last="194" mapSet="984" modifiers="f4"/>
@beny
beny / gist:000ea1cc869c1ac7d986
Created June 4, 2015 14:26
Objective-C inline functions & macros
static inline BOOL isEmpty(id thing) {
return (thing == nil)
|| ([thing respondsToSelector:@selector(length)] && [thing length] == 0)
|| ([thing respondsToSelector:@selector(count)] && [thing count] == 0)
|| ([thing isKindOfClass:[NSNull class]]);
}
@beny
beny / okruhy.txt
Last active August 29, 2015 14:01
Tématické okruhy MBI
init
@beny
beny / gist:11246371
Created April 24, 2014 08:24
Gitbox push config error
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 31 in /Users/myuser/.gitconfig
@beny
beny / gist:9617633
Last active August 29, 2015 13:57
Singular Value Decomposion - Ruby's GSL vs Python's NumPy
# in Ruby with GSL
>> m
=> GSL::Matrix
[ 1.000e+00 -1.000e+00
1.000e+00 0.000e+00
1.000e+00 1.000e+00 ]
>> m.svd
=> [GSL::Linalg::SV::UMatrix
[ -5.774e-01 7.071e-01
-5.774e-01 0.000e+00
@beny
beny / tm_properties
Created January 22, 2014 20:23
TextMate 2 properties file
scmStatus = false
invisiblesMap = "~ \t┊"
TM_RUBY = "$HOME/.rbenv/shims/ruby"
PATH = "$HOME/.rbenv/bin:$PATH"
fontSmoothing = true
excludeFiles = "*.{png,so,pyc,o,scssc}"
@beny
beny / gist:8502567
Created January 19, 2014 09:45
[UIImage preferredStatusBarStyle] If you have an image directly under your StatusBar (without a NavigationBar under it) then you should have the preferredStatusBar for that ViewController update to reflect the average color value for that image. ie. a dark image should have white text and a light image black text. source https://coderwall.com/p/…
@interface UIImage (mxcl)
@end
@implementation UIImage (mxcl)
- (UIStatusBarStyle)preferredStatusBarStyle {
UIGraphicsBeginImageContextWithOptions((CGSize){1, 1}, NO, 0.0);
[self drawInRect:(CGRect){0, 0, 1, 1}];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();