Skip to content

Instantly share code, notes, and snippets.

Honza Dvorsky czechboy0

Block or report user

Report or block czechboy0

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am czechboy0 on github.
  • I am honzadvorsky ( on keybase.
  • I have a public key ASDrO2xgsCJ5xuHgLnr4TfUqgexRE33AOzRyvLE080gOWwo

To claim this, I am signing this object:

#!/usr/bin/env bash
# Automatically installs swiftenv and run's swiftenv install.
# This script was designed for usage in CI systems.
git clone --depth 1 ~/.swiftenv
export SWIFTENV_ROOT="$HOME/.swiftenv"
if [ -f ".swift-version" ] || [ -n "$SWIFT_VERSION" ]; then
swiftenv install -s
czechboy0 /
Last active Sep 16, 2016
Fetch iTunes App reviews
# you find the app id of an app by calling the following API and parse the JSON
curl -X "GET" "$QUERY&country=us&entity=software"
# this is how you fetch the page 3 of the app with ID 911813648 (SwiftKey)
# you'd probably want to write a script and start fetching from page 1 up until you get 404 back
curl -X "GET" "$PAGE/id=$APPID/sortby=mostrecent/json?urlDesc=%2Fcustomerreviews%2Fid%3D$APPID%2FsortBy%3DmostRecent%2Fjson"
czechboy0 /
Last active Sep 6, 2016
Add 4 GB swapspace on Ubuntu 14.04
# based on
# run with eval "$(curl -sL"
echo "Starting with swap table:"
sudo swapon -s
echo "Available space:"
df -h
echo "Creating a 4GB swap file"
View extension-dictionary.swift
import Foundation
extension Collection where Iterator.Element == (key: String, value: FileWrapper) {
func hello() -> String {
return "world"
let dict: [String: FileWrapper] = [:]
View gist:517b22041c0eeb33f723bb66933882e4
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
View swift-self-build
# Faster toolchain build: skips as much as possible.
# To use this toolchain from the command line:"
# export TOOLCHAINS=$(whoami)
# we build to the same prefix every time (instead of building
# to a versioned prefix) because every time the prefix changes
# *everything* rebuilds.
czechboy0 /
Last active Mar 4, 2016
We need to talk about JSON "parsers".

We need to talk about JSON "parsers"

For the sake of a vibrant Swift community, we need to call things what they are. And what they aren't.

I recently wrote a JSON parser to accomodate for the lack of NSJSONSerialization on Linux. When searching for an existing one, I was caught by all these libraries which called themselves JSON parsers, but were in fact just wrapping calls to an actual underlying parser (usually NSJSONSerialization). They only provided convenience functions for unwrap values from dictionaries and mapping data to objects.

Those libraries are JSON-to-object mapping libraries. Those are JSON convenience function libraries.

# Installs the latest stable Redis version in a local directory
if [ -d ~/.redis-stable ]; then
echo "redis is already installed, ignoring..."
echo "Installing the latest Redis stable from source"
curl -O > /dev/null 2>&1
czechboy0 / After
Last active Jan 26, 2016
CryptoSwift 0.2.2 compilation times
View After
229.9ms /Users/honzadvorsky/Documents/CryptoSwift/Sources/CryptoSwift/AES.swift:215:18 private final func decryptBlock(block: [UInt8]) -> [UInt8]?
206.1ms /Users/honzadvorsky/Documents/CryptoSwift/Sources/CryptoSwift/AES.swift:297:18 private final func expandKeyInv(key: [UInt8], variant: AESVariant) -> [[UInt32]]
124.6ms /Users/honzadvorsky/Documents/CryptoSwift/Sources/CryptoSwift/SHA2.swift:116:10 final func calculate32() -> [UInt8]
115.3ms /Users/honzadvorsky/Documents/CryptoSwift/Sources/CryptoSwift/SHA1.swift:19:10 final func calculate() -> [UInt8]
77.4ms /Users/honzadvorsky/Documents/CryptoSwift/Sources/CryptoSwift/ChaCha20.swift:49:24 private final func wordToByte(input: [UInt32]) -> [UInt8]?
76.9ms /Users/honzadvorsky/Documents/CryptoSwift/Sources/CryptoSwift/SHA2.swift:198:10 final func calculate64() -> [UInt8]
75.7ms /Users/honzadvorsky/Documents/CryptoSwift/Sources/CryptoSwift/Poly1305.swift:263:18 private final func blocks(context: Context, m: [UInt8], startPos: Int = default) -> Int
72.6ms /Users
You can’t perform that action at this time.