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
% curl "http://weather.livedoor.com/forecast/webservice/json/v1?city=230010" | jq '.' | |
{ | |
"pinpointLocations": [ | |
{ | |
"link": "http://weather.livedoor.com/area/forecast/2310000", | |
"name": "名古屋市" | |
}, | |
{ | |
"link": "http://weather.livedoor.com/area/forecast/2320200", | |
"name": "岡崎市" |
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
% curl "http://api.openweathermap.org/data/2.5/forecast/daily?lat=35.0845611&lon=137.1706404&units=metric&appid=YOURAPIKEY" | |
{ | |
"city": { | |
"id": 1849814, | |
"name": "Toyota", | |
"coord": { | |
"lon": 137.149994, | |
"lat": 35.083328 | |
}, | |
"country": "JP", |
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
% curl "https://maps.googleapis.com/maps/api/geocode/json?address=豊田スタジアム&language=ja®ion=jp&key=YOUR_API_KEY" | jq "." | |
{ | |
"results": [ | |
{ | |
"address_components": [ | |
{ | |
"long_name": "豊田スタジアム", | |
"short_name": "豊田スタジアム", | |
"types": [ | |
"premise" |
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
require 'capybara' | |
require 'capybara/poltergeist' | |
def wait_for_ajax(session) | |
Timeout.timeout(Capybara.default_wait_time) do | |
return if session.evaluate_script('jQuery.active').blank? | |
loop until session.evaluate_script('jQuery.active').zero? | |
end | |
end | |
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
require 'google/apis/calendar_v3' | |
require 'active_support' | |
require 'active_support/core_ext' | |
service = Google::Apis::CalendarV3::CalendarService.new | |
# change here so you can specify your own Google calendar API access key | |
service.key = ENV['GOOGLE_CALENDAR_API_KEY'] | |
# Obtain every events within a year from 名古屋アジャイル勉強会 public calendar |
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
require 'google/apis/youtube_v3' | |
require 'active_support/all' | |
GOOGLE_API_KEY="YOUR_API_KEY" | |
def find_videos(keyword, after: 1.months.ago, before: Time.now) | |
service = Google::Apis::YoutubeV3::YouTubeService.new | |
service.key = GOOGLE_API_KEY | |
next_page_token = nil |
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 | |
# -*- coding: utf-8 -*- | |
import cv2 | |
import time | |
import tqdm | |
import numpy | |
if __name__ == "__main__": | |
img = cv2.imread('image.jpg') |
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
def iou(r1, r2): | |
x1, y1, w1, h1 = r1 | |
x2, y2, w2, h2 = r2 | |
and_x1, and_y1 = max(x1, x2), max(y1, y2) | |
and_x2, and_y2 = min(x1 + w1, x2 + w2), min(y1 + h1, y2 + h2) | |
and_w = and_x2 - and_x1 | |
and_h = and_y2 - and_y1 | |
if and_w <= 0 or and_h <= 0: | |
return 0 | |
and_area = and_w * and_h |
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
import tqdm | |
import multiprocessing | |
class ProcessSafeTqdm(tqdm.tqdm): | |
def __init__(self, *args): | |
super(ProcessSafeTqdm, self).__init__(*args) | |
self.correct_count = multiprocessing.Value('i', 0) | |
def update(self, n=1): | |
with self.correct_count.get_lock(): |
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
input: "data" | |
input_dim: 1 | |
input_dim: 3 | |
input_dim: 368 | |
input_dim: 368 | |
layer { | |
name: "conv1_1" | |
type: "Convolution" | |
bottom: "data" | |
top: "conv1_1" |