Instantly share code, notes, and snippets.

# Kanshi TANAIKE tanaikech

Last active October 14, 2016 05:07
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
 Declare a string variable arr, sum Declare an integer variable loopcounter Set arr to size n for loopcounter = 0 to (size of arr) - 1 sum = sum + arr[loopcounter] loopcounter = loopcounter + 1 endfor
Created October 14, 2016 05:13
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
 N_{l} = \sum_{k=1}^{\omega - 1} \frac{\theta}{\phi^{k}} \tag{1}
Created October 21, 2016 03:35
Pythonでリスト内要素を要素、重複数として重複数でソートして出力 ref: http://qiita.com/tanaike/items/5a94e9bb1154d1caefca
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
 data = ['a', 'b', 'c', 'd', 'b', 'c', 'd', 'b', 'c', 'b'] result = sorted({i: data.count(i) for i in set(data)}.items(), key=lambda x: x[1], reverse=True) print(result) >>> [('b', 4), ('c', 3), ('d', 2), ('a', 1)]
Created October 30, 2016 05:03
PythonでのCSVファイル出力の速度評価 ref: http://qiita.com/tanaike/items/f1a986a34e03dcbb7729
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 # -*- coding: UTF-8 -*- import time import csv import pandas as pd import SOUWA def measure_csv(ar): start = time.time()
Last active October 31, 2016 08:46
 var ss = SpreadsheetApp.getActiveSheet(); var data = ss.getDataRange().getValues(); for (var i in data){ for (var j in data[i]){ if (data[i][j].length > 0 && !/^[a-zA-Z0-9]+$/.test(data[i][j])){ data[i][j] = null; } } } ss.getRange("A1").offset(0,0, data.length, data[0].length).setValues(data); Last active December 31, 2016 01:44 OmniMarkupPreviewerでプレビューできない場合の対処法 ref: http://qiita.com/tanaike/items/816d3096cb7978e3452d 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  def makeExtension(configs=None): return StrikeoutExtension(configs=configs) Created January 11, 2017 05:15 ワンライナーコードでNetatmoからデータを取得, 表示する ref: http://qiita.com/tanaike/items/539dd06a1ffd7b7451e9 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  > setlocal & curl -s -d "grant_type=password&client_id='#####'&client_secret='#####'&username='#####'&password='#####'&scope=read_station" "https://api.netatmo.net/oauth2/token" | for /f "usebackq tokens=*" %a in (jq -r ".access_token") do @set a="%a" | curl -s -d "access_token=%a&device_id='#####'" "https://api.netatmo.net/api/getstationsdata" > dat.txt & for /f "usebackq tokens=*" %b in (jq -r ".body.devices[0].dashboard_data.Temperature" dat.txt) do @set b="%b" | echo: & set /p nb=Indoor: Temperature %b [degree C], Last active January 15, 2017 22:30 Google Apps Scriptでファイル名、フォルダ名からファイルへアクセスしたい ref: http://qiita.com/tanaike/items/94c263d3906ee23ad522 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  function F_number(file_name, folder_name) { var Array_files = []; var Array_folders = []; var fileIT = DriveApp.getFilesByName(file_name); while (fileIT.hasNext()) { Array_files.push(fileIT.next().getId()); }; var folderIT = DriveApp.getFoldersByName(folder_name); Last active January 20, 2017 08:24 コマンドラインからローカルPCまたはweb上の画像データを使ってGoogleの類似画像検索を行う ref: http://qiita.com/tanaike/items/dd89e41bf77bc3d96f51 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 スクリプト.py -f ファイル名