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
-- Different ways to handle nested keys | |
-- Data can be from an Android device installed as part of the | |
-- Open Auto Alliance. Hierarchy is Maker: Model: | |
-- Using bigint casting of 64-bit HEX android_id | |
CREATE KEYSPACE auto_data_space WITH replication = { | |
'class': 'SimpleStrategy', | |
'replication_factor': '3' | |
}; |
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
--Example of nested (i.e., controlled access) to medical device data | |
--used as part of eSource for medical trials | |
CREATE KEYSPACE med_devices WITH replication = { | |
'class': 'SimpleStrategy', | |
'replication_factor': '3' | |
}; | |
USE med_devices; |
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
""" | |
LENGTH OF A DEGREE OF LATITUDE AND LONGITUDE BY COORDINATE | |
Calculates length of a degree of latitude and longitude based on geodetic | |
meridian for any latitude and longitude position on an elipsoid without need of | |
any external API or data. Constants based on elipsoid values used in WGS84, | |
replicating calculation used b National Geospatial Agency (NDA) and CSGnet. | |
Formula is in a format that minimizes error at high latitudes by not dividing | |
by cosines (like haversine calculations). |
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 | |
""" | |
Remove duplicates rows from comma-separate value files. | |
Recommended for files saved in Windows CSV format. | |
Useful for situations where you will have duplicate data (e.g., sensor reads) | |
: param source : source csv file. Must end in .csv | |
Result is destination csv file without duplicates. |
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 | |
""" | |
Sort CSV file by multiple columns, writing output to sorted CSV file. | |
Recommended for files saved in Windows CSV format. | |
Useful for situations where data file is too large for Excel. | |
: param source_file.csv : source csv file. Must end in .csv | |
: param sort column 1 : first sort in Excel-like column number (i.e., 1 ... N) | |
Use negative number to indicate descending sort, | |
Positive number to indicate ascending sort_step |
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 | |
""" | |
Describes a CSV file.Recommended for files saved in Windows CSV format. | |
Useful for situations where you need to get some basic info on a huge CSV file | |
(logs, sensor data, etc.) | |
: param source : csv_file you want to describe. Must end in .csv | |
: optional param preview_size : number of rows to print raw data as preview | |
Result printed to screen: |
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 | |
""" | |
Remove a series of columns from a CSV file. | |
Recommended for files saved in Windows CSV format. | |
Useful for situations where you need to strip a huge and sparse CSV file | |
(e.g., logs, sensor data, etc.) | |
Can easily be converted to function for real-time use. | |
: param source : csv_file you want to strip. Must end in .csv |
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 | |
""" | |
Split CSV file into file segments, each with header plus N data rows. | |
Recommended for files saved in Windows CSV format. | |
Useful for situations break up huge CSV file for map/reduce-like processing | |
(e.g., logs, sensor data, etc.) | |
: param source : csv_file you want to strip. Must end in .csv | |
: param num_rows_per_file : Must be >= 1 |
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
/*** How Android does GPS ***/ | |
/* Source at https://github.com/android/platform_hardware_libhardware/blob/master/include/hardware/gps.h */ | |
typedef int64_t GpsUtcTime; /** Milliseconds since January 1, 1970 */ | |
/** Flags to indicate which values are valid in a GpsLocation. */ | |
typedef uint16_t GpsLocationFlags; | |
// IMPORTANT: Note that the following values must match | |
// constants in GpsLocationProvider.java. |
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 | |
""" | |
Converting lat, long into real addresses (and back) using pygeocoder. | |
Slower but more robust in terms of tolerance of partial addresses | |
and level of formated information provided. This still makes use of | |
Google's geocoding API V3. | |
Dependency: pip install pygeocoder | |
: param -a : geocode address |
OlderNewer