View NSData+HexString.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSData+HexString.swift | |
// Cybertk | |
// | |
// Created by Quanlong He on 8/14/15. | |
// Copyright © 2015 Quanlong He. All rights reserved. | |
// | |
import Foundation |
View gist:9d81d746a4b6600c85ee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boot2docker ssh "echo $'EXTRA_ARGS=\"--registry-mirror=<DOCKER_REGISTRY>\"' | sudo tee -a /var/lib/boot2docker/profile && sudo /etc/init.d/docker restart" |
View git-copy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Copy a remote git repo to another remote destination | |
# https://gist.github.com/cybertk/8a61ed9aca71a66cd711 | |
# | |
# Copyright (C) 2015 Quanlong <kyan.ql.he@gmail.com> | |
set -e | |
# Options validation |
View gist:fab6f469924d3bbfd9fb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :apns do | |
task :verify do | |
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert server_certificates_bundle_sandbox.pem -key server_certificates_bundle_sandbox.pem | |
openssl s_client -connect gateway.push.apple.com:2195 -cert pnpush.pem -key pnpush.pem | |
end | |
task :p12topem do | |
openssl pkcs12 -in apns.p12 -out apns.pem -nodes -clcerts |
View flynn-conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Flynn layer 0" | |
#start on (started libvirt-bin and started networking) | |
respawn | |
respawn limit 1000 60 | |
script | |
IP_ADDR=$(/sbin/ifconfig eth1 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}') | |
env ETCD_DISCOVERY=https://discovery.etcd.io/e73ebc86a75276ab5954ba7a6447ec94 | |
flynn-host daemon --manifest /etc/flynn/host-manifest.json --external $IP_ADDR --state /tmp/flynn-host-state.json |
View Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vi: set ft=ruby : | |
# Fail if Vagrant version is too old | |
begin | |
Vagrant.require_version ">= 1.6.0" | |
rescue NoMethodError | |
$stderr.puts "This Vagrantfile requires Vagrant version >= 1.6.0" | |
exit 1 | |
end |
View rake-update-version-android-manifest.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :update_build_number do | |
File.open('AndroidManifest.xml', 'r+') do |f| | |
manifest = f.read | |
build = ENV['TRAVIS_BUILD_NUMBER'] || 0 | |
# Update version | |
manifest = manifest.gsub( | |
/android:versionCode=".*"/, "android:versionCode=\"#{build}\"") | |
# Write back |
View android-dev-env-setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAC_SDK_DIR="/Applications/Android Studio.app/sdk" | |
LINUX_SDK_DIR="~/opt/android-sdk" | |
if [ -d "$MAC_SDK_DIR" ]; then | |
ANDROID_SDK=$MAC_SDK_DIR | |
fi | |
# Setup Android SDK Env | |
if [ -n "$ANDROID_SDK" ]; then | |
echo "Load Android SDK at $MAC_SDK_DIR" |
View rake-apns.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :apns do | |
task :verify do | |
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert server_certificates_bundle_sandbox.pem -key server_certificates_bundle_sandbox.pem | |
end | |
task :p12topem do | |
openssl pkcs12 -in apns.p12 -out apns.pem -nodes -clcerts | |
end | |
end |
View mocha_runtime_tests.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('chai').should() | |
Mocha = require 'mocha' | |
Test = Mocha.Test | |
Suite = Mocha.Suite | |
mocha = new Mocha | |
suite = Suite.create mocha.suite, 'I am a dynamic suite' | |
suite.addTest new Test 'I am a dynamic test', -> | |
true.should.equal true |