This file contains hidden or 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
| // | |
| // ViewController.swift | |
| // FingerTest | |
| // | |
| // Created by Kiichi Takeuchi on 8/29/15. | |
| // Copyright (c) 2015 ObjectGraph LLC. All rights reserved. | |
| // | |
| import UIKit | |
| import LocalAuthentication // add framework |
This file contains hidden or 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
| // Find interpolation points between two coordinates. e.g. 100 intervals | |
| // You can throw the list to MapQuest, for example. | |
| // Note : Download SphericalGeometry.cs from here | |
| // https://github.com/kiichi/spherical-geometry-dotnet | |
| using System; | |
| using System.Net; | |
| using System.Text; | |
| namespace ElevationTest { | |
| class MainClass { | |
| public static void Main (string[] args) { |
This file contains hidden or 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
| // Add System.Drawing as a reference. | |
| using System.Drawing; | |
| using System.Drawing.Drawing2D; | |
| using System.Drawing.Imaging; | |
| namespace ImageResizeTest { | |
| class Program { | |
| static void Main(string[] args) { | |
| string path = @"C:\\Users\kiichi\work\ImageResizeTest\geo-elevation.png"; | |
| Resize(path, 600, 600); |
This file contains hidden or 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
| // Download WritableBitmapEx Package from NuGet | |
| FileOpenPicker openPicker = new FileOpenPicker(); | |
| openPicker.ViewMode = PickerViewMode.Thumbnail; | |
| openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; | |
| openPicker.FileTypeFilter.Add(".png"); | |
| StorageFile file = await openPicker.PickSingleFileAsync(); | |
| if (file != null) { | |
| var fileStream = await file.OpenAsync(FileAccessMode.Read); | |
| WriteableBitmap wbmp = await BitmapFactory.New(1, 1).FromStream(fileStream); |
This file contains hidden or 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
| //////////////////////////////////////////////////////////////////////////////////////// | |
| // Environment: | |
| // Cloudera Quickstart VM | |
| // | |
| // How to compile: | |
| // export CLASSPATH=$CLASSPATH:.:/usr/lib/crunch/lib/hadoop-common.jar:/usr/lib/crunch/lib/hadoop-annotations.jar | |
| // javac MyHadoopIOTest.java | |
| // jar cvf MyHadoopIOTest.jar MyHadoopIOTest.class | |
| // /usr/bin/hadoop jar MyHadoopIOTest.jar MyHadoopIOTest | |
| // |
This file contains hidden or 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
| import Cocoa | |
| class ScreenshotViewController: NSViewController { | |
| override func prepareForSegue(segue: NSStoryboardSegue, sender: AnyObject?) { | |
| if let viewController = segue.destinationController as? PreviewViewController{ | |
| viewController.image = getScreenshot() | |
| } | |
| } | |
| func getScreenshot() -> NSImage { |
This file contains hidden or 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
| // arr is array of CLLocation. | |
| // Regular For-Loop Version | |
| for (var i=0; i<arr.count-1; i++) { | |
| totalDistance += arr[i].distanceFromLocation(arr[i+1]) | |
| } | |
| // Reduce Example 1: with argument. Note, passing total distance and first element as tuple. | |
| totalDistance = arr.reduce((0,arr[0])) { (accum,elem) -> (Double,CLLocation) in | |
| return (accum.0 + accum.1.distanceFromLocation(elem),elem) |
This file contains hidden or 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
| // Convert String to Int Array | |
| "123456".characters.map{Int(String($0))!} | |
| // Split and Convert | |
| "1 2 3 4 5 6".characters.split(" ").map{Int(String($0))!} |
This file contains hidden or 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
| class Node { | |
| var val:Int = -1 | |
| var prev:Node? = nil | |
| var next:Node? = nil | |
| init(inVal:Int){ | |
| val = inVal | |
| } | |
| } | |
| class LinkList { |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import pika | |
| server = '192.168.64.2' | |
| credentials = pika.PlainCredentials(username='test', password='test') | |
| connection = pika.BlockingConnection(pika.ConnectionParameters(host=server,credentials=credentials)) | |
| channel = connection.channel() | |
| channel.queue_declare(queue='hello') | |
| def callback(ch, method, properties, body): |