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
User.where(weight_unit: "lbs").where.not(weight: nil).find_each { |u| u.athlete_profile.update!(precise_weight: (u.weight * 0.45359237).round(1)) } |
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
DEVICE_ID="pmsensor-" .. string.format("%02X", node.chipid()) | |
BOOT_WAIT = 3 | |
DWEET_INTERVAL = 60 | |
LED_PIN = 4 | |
pm25 = nil | |
pm10 = nil | |
function led(state) |
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 "open-uri" | |
require "fileutils" | |
open("attachments.csv").each do |line| | |
path, url = line.split(",", 2) | |
puts path | |
FileUtils.mkdir_p(File.dirname(path)) | |
open(path, "w") { |f| f.write(open(url).read) } unless File.exist?(path) | |
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
Attachment.find_each { |a| f = a.file; f.fog_authenticated_url_expiration = 24.hours.to_i; puts "#{f.path},#{f.url}" } |
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
#!/bin/bash | |
export DEBIAN_FRONTEND=noninteractive | |
# reduce the server load and free as much memory as we can | |
service unicorn stop | |
service nginx stop | |
service postgresql stop | |
# remove the old postgresql |
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
aleja|die Allee, -n| | |
starówka|die Altstadt, die Altstädte<br>| | |
zagranica|das Ausland| | |
wieś|das Dorf, die Dörfer| | |
okolica (G…)|die Gegend, -en| | |
duże miasto|die Großstadt, die Großstädte| | |
stolica|die Hauptstadt, die Hauptstädte| | |
numer domu|die Hausnummer, -n| | |
centrum miasta|die Innenstadt, die Innenstädte| | |
małe miasto|die Kleinstadt, die Kleinstädte| |
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
User.where("NOT EXISTS (SELECT 1 FROM athlete_profiles WHERE athlete_profiles.fl_uid = users.fl_uid)").find_each { |user| Athlete::ProfileBuilder.new(user_id: user.id).call } |
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 "optparse" | |
require "json" | |
require "net/http" | |
options = {} | |
OptionParser.new do |parser| | |
parser.banner = "Usage: sds011.rb [options]" | |
parser.on("-dDEVICE", "--device DEVICE", "SDS011 serial port path") do |device| |
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 "json" | |
require "net/http" | |
SDS011_DEV = "/dev/ttyUSB0" | |
FIREBASE_HOST = "airsensor.firebaseio.com" | |
AUTH_TOKEN = "B1K9LMmwtYR8EwXtSTztUUwhaC7IjE5HWUOOuSfk" | |
header, command, pm25l, pm25h, pm10l, pm10h, id1, id2, sum, tail = IO.read(SDS011_DEV, 10).unpack("CCCCCCCCCC") | |
if header == 0xAA && command == 0xC0 && (pm25l + pm25h + pm10l + pm10h + id1 + id2) % 256 == sum && tail == 0xAB |
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
(add-hook 'js2-mode-hook 'qoobaa/js2-mode-setup) | |
(defun qoobaa/js2-mode-setup () | |
(let ((local-eslint (expand-file-name "node_modules/.bin/eslint" (projectile-project-root)))) | |
(when (file-exists-p local-eslint) | |
(setq flycheck-javascript-eslint-executable local-eslint) | |
(js2-mode-hide-warnings-and-errors) | |
(flycheck-mode t) | |
(flycheck-select-checker 'javascript-eslint)))) |