Skip to content

Instantly share code, notes, and snippets.

View n0531m's full-sized avatar
💭
in the ☁

Naoya Moritani n0531m

💭
in the ☁
View GitHub Profile
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
@n0531m
n0531m / listKsjZipFiles.py
Last active August 29, 2015 14:20
list ksj zip file urls
# http://nlftp.mlit.go.jp/ksj/api/about_api.html
# sudo port install py27-lxml
#sudo easy_install pip
#xcode-select --install
#sudo pip install lxml
import urllib2
from lxml import etree
@n0531m
n0531m / list_gcp_iprange.sh
Last active April 17, 2024 21:50
Google Cloud Platform : ip address range
#!/bin/bash
# https://cloud.google.com/compute/docs/faq#find_ip_range
# nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
myarray=()
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`
do
myarray+=($LINE)
for LINE2 in `dig txt $LINE +short | tr " " "\n" | grep include | cut -f 2 -d :`
@n0531m
n0531m / BQ to SpreadSheet.js
Last active June 11, 2020 04:41
Google Apps Script that updates spreadsheet and shows chart based on BigQuery query
// replace with project number
var projectNumber = 'xxxxxxx';
// replace with Sheets's ID
var ssid = "xxxxxxx";
var ss = SpreadsheetApp.getActiveSpreadsheet();
function getSpreadsheetId(){
@n0531m
n0531m / gist:bf0437e06b1c1c697cd1b82a7cb8c39a
Created September 28, 2016 00:12
To see which processes (files) are consuming a range of ports, use the List Open Files
# To see which processes (files) are consuming a range of ports, use the List Open Files command
lsof -i :8000-8020
@n0531m
n0531m / copyDoc.js
Created December 14, 2016 08:33
AppsScript to copy doc if updated
//This script should be stored in Drive as a AppScript file and configured to run at intervals
//In my case, run it every two hours and copied the doc if there was an update
//ID of original document
var srcDocId="xxxxxx";
//ID of desitination Folder
var targetFolderId= "xxxxxx";
function copyDoc() {
copyDocIfUpdated(srcDocId,targetFolderId,2);
@n0531m
n0531m / start_syntaxnet.sh
Created May 21, 2017 01:26
start a docker container with SyntaxNet
#!/bin/bash
docker run -it -p 8888:8888 tensorflow/syntaxnet
@n0531m
n0531m / datalab_start.sh
Last active May 21, 2017 01:28
start cloud datalab container image locally
#!/bin/bash
docker run -it -p 127.0.0.1:8081:8080 -v $HOME/datalab:/content -e PROJECT_ID=sandbox-moritani gcr.io/cloud-datalab/datalab:local
@n0531m
n0531m / datalab_update.sh
Created May 21, 2017 01:29
update local datalab container image
#!/bin/bash
docker pull gcr.io/cloud-datalab/datalab:local
@n0531m
n0531m / bigquery_udf_latlng2coordinates.sql
Last active October 30, 2017 00:46
calculate coordinates from latlng
# this is a udf sample to calculate coordinates from latlng
# https://developers.google.com/maps/documentation/javascript/examples/map-coordinates
CREATE TEMPORARY FUNCTION
project (latitude FLOAT64, longitude FLOAT64, zoom FLOAT64)
RETURNS STRUCT < worldCoordinate_x float64,
worldCoordinate_y float64,
pixelCoordinate_x float64,
pixelCoordinate_y float64,
tileCoordinate_x float64,
tileCoordinate_y float64 >