Skip to content

Instantly share code, notes, and snippets.

View cannabis-3k_similarity-plot.R
# dependencies
library("moduleColor")
library("dynamicTreeCut")
library("RColorBrewer")
# import data
canna.z = read.csv("~/Downloads/canna-z.csv",header=T,row.names=1)
#https://github.com/mattsarrasin/canna-gen/blob/master/sample_description_list-2.txt
id2name = read.csv('~/Downloads/results-20200327-155748.csv')
@allenday
allenday / convert-to-geography
Last active Feb 4, 2020
Load GFF v3 data to BigQuery
View convert-to-geography
SELECT
seq_id,source,type,seq_start,seq_end,
ST_MAKELINE(ST_GEOGPOINT(LOG(seq_start)/LOG(10),-0.01),ST_GEOGPOINT(LOG(seq_end)/LOG(10),0.01)) AS range_log10,
score,strand,phase,attributes
FROM `project.dataset.tablename`
LIMIT 1000
View gcloud-create-gpu-instance.sh
gcloud compute instances create XXX --project=XXX --image-project=deeplearning-platform-release --image-family=tf-latest-gpu --maintenance-policy=TERMINATE --boot-disk-size 200GB --accelerator="type=nvidia-tesla-v100,count=1" --metadata="install-nvidia-driver=True" --zone="us-west1-b"
@allenday
allenday / tensorflow_json_parser.py
Last active Jan 2, 2020 — forked from sameerg07/tensorflow_json_parser.py
converts the json file downloaded using image classifer tool of dataturks to dataset folder
View tensorflow_json_parser.py
#This script has been solely created under dataturks. Copyrights are reserved
#EXAMPLE USAGE
#python3 tensorflow_json_parser.py --json_file "flower.json" --dataset_path "Dataset5/"
import json
import glob
import urllib.request
@allenday
allenday / prolific-users.sql
Created Dec 27, 2019
Which users have contributed the most relations to the current version of OpenStreetMap?
View prolific-users.sql
SELECT username, COUNT(*) AS c
FROM
`bigquery-public-data.geo_openstreetmap.planet_relations` AS relations
GROUP BY username
ORDER BY c DESC
@allenday
allenday / fire-hydrants-globally-obsolete.sql
Last active Dec 27, 2019
Find all obsolete fire hydrants on the planet
View fire-hydrants-globally-obsolete.sql
SELECT *
FROM
`bigquery-public-data.geo_openstreetmap.history_nodes` AS node JOIN UNNEST(all_tags) AS tags
WHERE
(tags.key = 'emergency' AND tags.value = 'fire_hydrant')
AND id NOT IN (
SELECT id
FROM
`bigquery-public-data.geo_openstreetmap.planet_nodes` AS node JOIN UNNEST(all_tags) AS tags
WHERE
@allenday
allenday / changesets-in-singapore.sql
Created Dec 27, 2019
Find all OpenStreetMap changeset IDs that contain points in Singapore's geographical extent
View changesets-in-singapore.sql
WITH singapore AS (
SELECT ST_MAKEPOLYGON(ST_MAKELINE(
[ST_GEOGPOINT(103.6920359,1.1304753),ST_GEOGPOINT(104.0120359,1.1304753),
ST_GEOGPOINT(104.0120359,1.4504753),ST_GEOGPOINT(103.6920359,1.4504753)
]
)) AS boundingbox
)
SELECT DISTINCT changeset.id
FROM
View get_partitions.sql
CREATE OR REPLACE FUNCTION
`osm_planet.get_partitions`(name STRING)
RETURNS ARRAY<DATE> AS (
CASE
WHEN name="place-city" THEN ARRAY<DATE>["1970-01-01"]
WHEN name="place-town" THEN ARRAY<DATE>["1970-01-02"]
WHEN name="place-village" THEN ARRAY<DATE>["1970-01-03"]
WHEN name="place-hamlet" THEN ARRAY<DATE>["1970-01-04"]
WHEN name="place-national_capital" THEN ARRAY<DATE>["1970-01-05"]
WHEN name="place-suburb" THEN ARRAY<DATE>["1970-01-06"]
View top-osm-features.sql
SELECT
LOWER(tags.key) AS k
,LOWER(tags.value) AS v
,COUNT(*) AS c
FROM `bigquery-public-data.geo_openstreetmap.features` JOIN UNNEST (all_tags) AS tags
WHERE LOWER(key) NOT IN (
'source','import','created_by','restriction','attribution','note','operator','mapper','province','objtype','name','ref','wikidata','alt_name','fixme','name_1','int_name','int_ref','hgv','old_ref','old_name','official_name','import_uuid','to','from','description','denotation','brand','email','opening_hours','notas','tipo','rcn_ref'
)
AND key NOT LIKE '%:%'
AND key NOT LIKE '%"%'
View junk.csv
http://tf-models.arilot.org/static-tf-models/img/Abstract-Patterned_Blouse/img_00000049.jpg blouse
http://tf-models.arilot.org/static-tf-models/img/Abstract-Stripe_Fuzzy_Sweater/img_00000011.jpg sweater
You can’t perform that action at this time.