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
| package com.github.modalsoul.luhn | |
| object LuhnApp extends App { | |
| // Success | |
| println(Luhn.check("49927398716")) | |
| // Failure | |
| println(Luhn.check("49972398716")) | |
| } | |
| object Luhn { |
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 argparse | |
| import time | |
| from selenium import webdriver | |
| URL = 'https://www.japannetbank.co.jp/service/payment/web_all/csv_download.html' | |
| DOWNLOAD_PATH = '/PATH/TO/DOWNLOAD' | |
| def enable_download_in_headless_chrome(driver, download_dir): | |
| driver.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command') | |
| params = {'cmd': 'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}} |
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 argparse | |
| import time | |
| from selenium import webdriver | |
| URL = 'https://www.japannetbank.co.jp/service/payment/web_all/csv_download.html' | |
| DOWNLOAD_PATH = '/PATH/TO/DOWNLOAD' | |
| def enable_download_in_headless_chrome(driver, download_dir): | |
| driver.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command') | |
| params = {'cmd': 'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}} |
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
| FROM python:3.6-alpine3.8 | |
| ENV APP_ROOT=${APP_ROOT:-/opt/app} | |
| # update apk repo | |
| RUN echo "http://dl-4.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories && \ | |
| echo "http://dl-4.alpinelinux.org/alpine/v3.8/community" >> /etc/apk/repositories | |
| # install chromedriver | |
| RUN apk update | |
| RUN apk add chromium chromium-chromedriver |
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 time | |
| from selenium import webdriver | |
| URL = 'https://www.post.japanpost.jp/zipcode/dl/oogaki-zip.html' | |
| DOWNLOAD_PATH = '/opt/app/scraping/dst' | |
| def enable_download_in_headless_chrome(driver, download_dir): | |
| driver.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command') | |
| params = {'cmd': 'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}} |
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
| FROM python:3.6-alpine3.7 | |
| ENV APP_ROOT=${APP_ROOT:-/opt/app} | |
| # update apk repo | |
| RUN echo "http://dl-4.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \ | |
| echo "http://dl-4.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories | |
| # install chromedriver | |
| RUN apk update | |
| RUN apk add chromium chromium-chromedriver |
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
| var refuelingDateCol = 2; | |
| var distanceCol = 3; | |
| var oilingQuantityCol = 4; | |
| var feeCol = 5; | |
| var groupingMonthCol = 5; | |
| var groupingDistanceCol = 6; | |
| var groupingFuelConsumptionCol = 7; | |
| var mySheetURL = 'http://your/form/url' | |
| function myFunction() { |
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
| object Maverick { | |
| def main(args:Array[String]) { | |
| (0 to 9).permutations.flatMap(Mavericksl(_)).withFilter(_.valid).foreach(println) | |
| } | |
| case class Mavericksl(m:Int, a:Int, v:Int, e:Int, r:Int, i:Int, c:Int, k:Int, s:Int, l:Int) { | |
| override def toString = s"M:$m, A:$a, V:$v, E:$e, R:$r, i:$i, C:$c, K:$k, S:$s, L:$l" | |
| val mave = m*1000 + a*100 + v*10 + e | |
| val rick = r*1000 + i*100 + c*10 + k | |
| val scala = s*10000 + c*1000 + a*101 + l*10 |
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 partialSum(n:Int, a:Seq[Int], k:Int, i:Int = 0, sum:Int = 0):Boolean = { | |
| if(i == n) sum == k | |
| else partialSum(n, a.tail, k, i+1, sum+a.head) || partialSum(n, a.tail, k, i+1, sum) | |
| } | |
| val a = Seq(1,2,4,7) | |
| println(partialSum(a.length, a, 13)) | |
| println(partialSum(a.length, a, 15)) |
NewerOlder