Skip to content

Instantly share code, notes, and snippets.

View czechboy0's full-sized avatar

Honza Dvorsky czechboy0

View GitHub Profile
#!/bin/bash
# Shell script to change a Swift package dependency to another branch
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
git checkout $1
@czechboy0
czechboy0 / add_swap.sh
Last active September 6, 2016 14:00
Add 4 GB swapspace on Ubuntu 14.04
# based on https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
# run with eval "$(curl -sL https://gist.githubusercontent.com/czechboy0/ba249dc375dd6335f30f7acd593aa193/raw/add_swap.sh)"
echo "Starting with swap table:"
sudo swapon -s
echo "Available space:"
df -h
echo "Creating a 4GB swap file"
#!/bin/bash
#
# 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.
@mxcl
mxcl / Lockfile.md
Last active March 13, 2016 12:39 — forked from ankitspd/Lockfile.md
Lock file proposal

Dependency Locking with the Swift Package Manager

Introduction

In a vibrant packaging ecosystem, dependencies update continuously with bug-fixes and feature improvements. When working against a collection of dependencies, especially in a team, it is vital to lock the graph and update it so that all team members receive the exact same graph at the same time.

The typical flow for this in dependency management is to create and use a dependency “Lockfile”.

Motivation

#!/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 https://github.com/kylef/swiftenv.git ~/.swiftenv
export SWIFTENV_ROOT="$HOME/.swiftenv"
export PATH="$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH"
if [ -f ".swift-version" ] || [ -n "$SWIFT_VERSION" ]; then
swiftenv install -s
@cojoj
cojoj / method.swift
Created July 2, 2015 20:22
Guard coverage
// Got this method which makes call to API, blah, blah, blah...
self.sendRequestWithMethod(.GET, endpoint: .Repositories, params: nil, query: nil, body: nil) { (response, body, error) -> () in
guard error == nil else {
completion(repositories: nil, error: error)
return
}
guard let repositoriesBody = (body as? NSDictionary)?["results"] as? NSArray else {
completion(repositories: nil, error: Error.withInfo("Wrong body \(body)"))
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
@jaredbeck
jaredbeck / com.gocongress.backup.plist
Created May 1, 2011 22:07
Example of launchd plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Contains a unique string that identifies your daemon to launchd.
This key is required. -->
<key>Label</key>
<string>com.gocongress.backup</string>