Skip to content

Instantly share code, notes, and snippets.

View johndpope's full-sized avatar

John D. Pope johndpope

View GitHub Profile
call the 'minElement()' method on the sequence
call the 'maxElement()' method on the sequence
call the 'indexOf()' method on the collection
|Use the split() method instead.
call the 'startsWith()' method on the sequence
call the 'startsWith()' method on the sequence
call the 'enumerate()' method on the sequence
call the 'equalElements()' method on the sequence
call the 'equalElements()' method on the sequence
call the 'lexicographicalCompare()' method on the sequence
// A test case that displays an animated weather layer on top of
// the standard Geography Class basemap.
// This is part of the AutoTester in the WhirlyGlobe-Maply repo.
class AnimatedBasemapTestCase: MaplyTestCase {
// Use Geography Class as the base layer
let geographyClass = GeographyClassTestCase()
let cacheDir = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0]
var tileSources = [MaplyRemoteTileInfo]()
@leoniralves
leoniralves / getPropertiesSwift.swift
Created July 14, 2016 22:25
Get Properties Swift
struct Person {
let name: String
let lastname: String
}
class Reflection {
func printProperties(mirror: _MirrorType) {
for i in 0..<mirror.count {
let (name, childMirror) = mirror[i]
let value = childMirror.value
@vishwasbabu
vishwasbabu / gist:6433127
Last active October 11, 2016 17:52
MySQL Commands
--Enable MySQL General Log
SET global general_log = 1;
SET global log_output = 'table';
--MySQL Dump
mysqldump -uroot -ppassword dbname > dump.sql
--enable access from a particular system
GRANT ALL PRIVILEGES ON *.* TO root@106.51.132.21 identified by "password"
@deathcult
deathcult / mysql_kill_sleep_proc.sh
Last active October 11, 2016 17:53
kill mysql sleep process
#!/bin/sh
## MySQL 5.1.61
## sleep时间大于等于10秒,kill掉:
mysqladmin -u* -p* processlist |grep -i sleep |awk '{if($12>=10) print $2}' |xargs -n1 mysqladmin -u* -p* kill
mkdir ~/projects
cd ~/projects
git clone --recurse-submodules https://github.com/petewarden/tensorflow_ios.git tensorflow_ios
cd tensorflow_ios
mkdir tools
mkdir tools/objc
echo '
filegroup(
name = "default_provisioning_profile",
srcs = ["default_provisioning_profile.mobileprovision"],
@djtfmartin
djtfmartin / Dockerfile
Last active October 20, 2016 21:42
Base dockerfile
FROM ubuntu:14.04
MAINTAINER Dave Martin <David.Martin@csiro.au>
RUN apt-get update && apt-get -y install openssh-server supervisor
RUN mkdir /var/run/sshd
RUN echo 'root:password' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
@lopezjurip
lopezjurip / docker-compose.yml
Created June 20, 2016 04:04
HAProxy: expose containers with subdomains
webclient:
environment:
- NODE_ENV=production
- VIRTUAL_HOST=myapp.com
build: 'webclient' # this directory must have a Dockerfile
links:
- mongo
restart: always
lb:
@wolfeidau
wolfeidau / Dockerfile
Created May 15, 2015 04:14
Buildkite Agent
FROM buildkite/agent
RUN apt-get update -y && \
apt-get install --no-install-recommends -y -q curl build-essential ca-certificates git mercurial bzr
RUN mkdir /goroot && curl https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz | tar xvzf - -C /goroot --strip-components=1
RUN mkdir /gopath
ENV GOROOT /goroot
ENV GOPATH /gopath
@hosopy
hosopy / HelloWorldViewController.swift
Last active November 6, 2016 18:02
XCode(Swift) + CocoapodsでgRPCのClientを生成してServiceを呼び出すまでの流れ ref: http://qiita.com/hosopy/items/957af2887e73923305df
import Foundation
import UIKit
import RemoteClient
class HelloWorldViewController: UIViewController {
...
@IBAction func requestButtonPressed(sender: UIButton) {
// For debug
// 非SSLでの接続には必要