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 updateWeeklyStddevSheet() { | |
const config = getConfig(); | |
var sheet = getSheet('Weekly Stddev'); | |
var weeklySheet = getSheet('Weekly'); // Changed to weekly sheet | |
var dataRange = weeklySheet.getDataRange(); // Changed to weekly sheet | |
var data = dataRange.getValues(); | |
var weeklyData = {}; | |
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
import time | |
item = { | |
"images": ["img1", "img2", "img1"] | |
} | |
while True: | |
print("------ new loop") | |
# original scraper code: |
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
# | |
# 1. define replacements | |
# | |
replacements = { | |
'germany' => { | |
# this has the following structure: | |
# 'correct city name' => ['variant to fix 1', 'variant to fix 2', ...] | |
# the variants DO NOT repeat the correct city name, neither downcased nor capitalized. | |
'Berlin' => ['Берлин', 'Berlin, Stadt', 'Berlin / Biesdorf', 'Berlin-Prenzlauer Berg', 'Berlin-Wedding'], |
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
# add a db schema migration to add geocoded_at to listings | |
add_column :listings, :geocoded_at, :timestamp, default: nil | |
# add a geocoded? method to the model | |
class Listing < ApplicationRecord | |
def geocoded? | |
read_attribute(:geocoded) || geocoded_at.present? | |
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
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'redis' | |
gem "hiredis-client" | |
# gem 'rspec' | |
end | |
require "hiredis-client" # speed optimized redis client |
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
require 'open-uri' | |
`mkdir files` | |
URL = 'https://www.cia.gov/library/abbottabad-compound/index_video.html' | |
html = URI.open(URL).read | |
files = html.scan(/"\.(.*Jerry.*\.rm(vb)?)">/i) | |
urls = files.map { |a| URL.gsub('/index_video.html', a.first) } |
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
module Cs | |
module Hanami | |
class PathResolver | |
def self.call(env) | |
new.call(env) | |
end | |
def call(env) | |
path = env['REQUEST_URI'].split('?').first # path without query string | |
return 'root' if path == '/' |
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
sub sendFTPs($) { | |
my $lftpfile = shift; | |
# apt install liblwp-protocol-https-perl libfile-slurp-perl | |
use HTTP::Request qw(); | |
use HTTP::Headers qw(); | |
use LWP::UserAgent (); | |
use File::Slurp qw(read_file); | |
# Cerascreen hostnames: |
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
created_organizations = {} | |
MedlineOrganization.find_each do |organization| | |
# ... | |
key = new_organization[:organization][:external_id] | |
if created_organizations[key] | |
print "x" | |
else | |
created_organizations[key] = zendesk_account.organizations.create(new_organization[:organization]) | |
print "." |
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
file = File.read('app/views/content/privacy.html.slim') | |
file.gsub(/\((https?:\/\/.+\))/, '\n = link_to(\'(\1)\')') |
NewerOlder