Skip to content

Instantly share code, notes, and snippets.

View kimar's full-sized avatar
📱
Building and improving Mobile Products since 2009.

Marcus Kida kimar

📱
Building and improving Mobile Products since 2009.
View GitHub Profile
@kimar
kimar / hello.swift
Created June 25, 2015 10:33
Hello World Swift CLI App
#!/usr/bin/xcrun swift
import AppKit
struct Hello {
static func talk () {
println("Hello World!")
}
}

Keybase proof

I hereby claim:

  • I am kimar on github.
  • I am kimar (https://keybase.io/kimar) on keybase.
  • I have a public key whose fingerprint is 96E6 3A93 47F6 0FAC 4235 25E1 76EE 3607 81F7 6609

To claim this, I am signing this object:

#
# File compressor plugin for jekyll
# =================================
#
# By [mytharcher](https://github.com/mytharcher)
# 2012-05-20
#
# Updated by [nicoespeon](https://github.com/nicoespeon)
# 2013-04-12
#
@kimar
kimar / gist:483b9fd334a4cfabfb08
Created September 1, 2014 23:25
Ghost S3 getTargetDir for Windows instances
var getTargetDir = function() {
var now = new Date();
return now.getFullYear() + '-' + MONTHS[now.getMonth()] + '/';
};
@kimar
kimar / do-bandwidth-shutdown
Created June 15, 2014 15:42
DigitalOcean Shutdown after exceeding 999 GB (Credit goes to: http://pastebin.com/2vXMBaSi)
#!/bin/bash
ax=`vnstat --oneline | awk -F ";" '{print $11}'`
if [[ "$ax" == *GiB* ]];
then
if [ $(echo "$(echo "$ax" | sed 's/ GiB//g') > 999"|bc) -eq 1 ]
then
shutdown -h now
fi
fi
@kimar
kimar / gist:8597623
Created January 24, 2014 13:52
Kill iPhone Simulator in case it's running to prevent Xcode from nagging you
killall "iPhone Simulator"; sleep 2; exit 0;
@kimar
kimar / gist:8583975
Last active January 4, 2016 06:48
Git Commit-Hash based Build Versioning for your iOS Project
/usr/libexec/Plistbuddy -c "Set CFBundleVersion $(git log --pretty=format:'%h' -n 1)" "${PROJECT_DIR}/${INFOPLIST_FILE}"
@kimar
kimar / gist:8371200
Created January 11, 2014 13:58
Increase iOS / Mac OS X Build number on Release
if [ $CONFIGURATION == Release ]; then
echo "Bumping build number..."
plist=${PROJECT_DIR}/${INFOPLIST_FILE}
# increment the build number (ie 115 to 116)
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}")
if [[ "${buildnum}" == "" ]]; then
echo "No build number in $plist"
exit 2
fi
@kimar
kimar / availableTcpPort.m
Created July 3, 2013 09:31
Returns available TCP Port in Objective-C / Cocoa
- (int) availableTcpPort
{
struct sockaddr_in addr;
socklen_t len = sizeof(addr);
addr.sin_port = 0;
inet_aton("0.0.0.0", &addr.sin_addr);
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
perror("socket()");
return -1;