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
# for CVE-2020-10663 | |
# https://www.ruby-lang.org/en/news/2020/03/19/json-dos-cve-2020-10663/ | |
if Gem::Version.create(JSON::VERSION) < Gem::Version.create('2.3.0') | |
module JSON | |
class << self | |
alias :old_parse :parse | |
def parse(json, args = {}) | |
old_parse(json, args || {}) | |
end | |
end |
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
### Keybase proof | |
I hereby claim: | |
* I am purintai on github. | |
* I am purintai (https://keybase.io/purintai) on keybase. | |
* I have a public key ASCMsA1xrtUKUuJY1i_NgUnLfzA_crDmAKvdz5fKgeX2zgo | |
To claim this, I am signing this object: |
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
GET /products/_search | |
{ | |
"query": { | |
"bool": { | |
"must": { | |
"script": { | |
"script": { | |
"lang": "painless", | |
"inline": "doc['sale_price'].value > 0 && doc['sale_begin_at'].value <= params.t && doc['sale_end_at'].value > params.t", | |
"params": { |
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
csv = CSV.open(path, headers: true) | |
touched = [] | |
csv.each do |row| | |
params = row.to_h | |
ProductUpdateWorker.perform_async(params) | |
touched << params['code'] | |
end | |
Product.where.not(code: touched).destroy_all |
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
// Only for Google Scripts | |
function kakakucomPrice(itemUrl) { | |
try { | |
var response = UrlFetchApp.fetch(itemUrl); | |
if (response.getResponseCode() == 200) { | |
var html = response.getContentText(); | |
re = /ecomm_totalvalue: \'(\d+)\'/; | |
var result = html.match(re); | |
if (result == null) { | |
return "Sold out"; |