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
// bytes | |
var buffer: [UInt8] = [0b11111111, 0b11111100, 0b0101, 0b00001] | |
// get part of bytes | |
var data = NSData(bytes: [UInt8(buffer[0])], length: sizeof(UInt8)) | |
var target: UInt8 = 0 | |
data.getBytes(&target, length: sizeofValue(data)) | |
print(target) // 255 |
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
{ | |
"status": "ok", | |
"message": "test response" | |
} |
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
from django.test import TestCase | |
class SomeAPITestCase(TestCase): | |
fixtures = [ | |
'fixtures/someapi/user.yaml', | |
] | |
def setUp(self): | |
super(SomeAPITestCase, self).setUp() |
NewerOlder