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
# | |
# python drive.py 'origin' ['waypoint' ... ] 'destination' --apikey=GOOGLE_MAPS_APIKEY | |
# | |
# i.e. python drive.py 'Union Square, San Francisco' 'Ferry Building, San Francisco' 'Bay Bridge' SFO | |
import hashlib | |
import json | |
import sys | |
import urllib | |
import os | |
from urllib.parse import quote_plus |
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
#include <math.h> | |
/** | |
以下を参考に実装 | |
https://cttr.jp/2019/04/10/post-453/ | |
https://github.com/buckhx/QuadKey/blob/master/quadkey/tile_system.py | |
*/ | |
struct PixelXY { | |
int x; | |
int y; |
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
/* | |
* This code is example to get environment variable and upload to google spreadsheet. | |
* | |
* Requirements: | |
* - M5STACK (I tested this code on M5STACK FIRE) | |
* - Adafruit_BMP280 library | |
* - DHT12 library | |
* | |
* Usage: | |
* - Connect env unit to M5Stack port A. |
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
import json | |
# JSON文字列をPythonオブジェクトにする | |
print(json.loads('{"key":"value"}')) | |
# PythonオブジェクトをJSON文字列にする | |
print(json.dumps({"key":"value"})) |
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
#include <TinyGPS++.h> | |
#include <SoftwareSerial.h> | |
#include <SakuraIO.h> | |
#include <string.h> | |
/* | |
This sample code demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object. | |
It requires the use of SoftwareSerial, and assumes that you have a | |
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx). | |
*/ |
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
#!/usr/bin/env python | |
import timeit | |
def mmh3_test(): | |
import mmh3 | |
for i in range(0, 100000): | |
mmh3.hash(str(i)) |
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
var x: Double = 0.99043125417 | |
var length = sizeof(Double) // -> 8 | |
var x_data = NSData(bytes: &x, length: length) | |
var buffer = [UInt8](count: sizeof(Double), repeatedValue: 0x00) | |
x_data.getBytes(&buffer, length: buffer.count) | |
print(buffer) // -> "[210, 21, 179, 226, 156, 177, 239, 63]\n" |
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
- (id)init | |
{ | |
self = [super init]; | |
if (self) { | |
_locationManager = [[CLLocationManager alloc] init]; | |
_locationManager.delegate = self; | |
[_locationManager startUpdatingLocation]; | |
[Flurry startSession:@"YOUR_FLURRY_API_KEY"]; | |
} |
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
UIApplication *app = [UIApplication sharedApplication]; | |
if (app.backgroundRefreshStatus == UIBackgroundRefreshStatusAvailable) { | |
NSLog(@"バックグラウンド更新が可能"); | |
} else if(app.backgroundRefreshStatus == UIBackgroundRefreshStatusDenied) { | |
NSLog(@"バックグラウンド更新はユーザによって禁止されている。"); | |
} else if(app.backgroundRefreshStatus == UIBackgroundRefreshStatusRestricted) { | |
NSLog(@"デバイス設定により無効にされている(ユーザが有効にすることは出来ない)。"); | |
} |
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
>>> def a(): print 'a'; return False | |
>>> def b(): print 'b'; return True | |
>>> if a() and b(): | |
... print 'hogehoge' | |
... | |
a |
NewerOlder