Skip to content

Instantly share code, notes, and snippets.

@lowang
lowang / docker-compose.yml
Created January 13, 2022 10:41
Bare docker-compose file used for setting up prestashop
version: "3.4"
services:
mysql:
image: mariadb:10.6
restart: always
environment:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: '1'
volumes:
- mysqldata:/var/lib/mysql
@lowang
lowang / configuration.yaml
Last active October 25, 2023 19:29
[PL] Energa Operator energy meter sensor
# multiscrape can be found in HACS, src: https://github.com/danieldotnl/ha-multiscrape
multiscrape:
- resource: 'https://mojlicznik.energa-operator.pl/dp/UserData.do'
scan_interval: 43200 # 12h
form_submit:
submit_once: True
resource: 'https://mojlicznik.energa-operator.pl/dp/UserLogin.do'
select: "#loginForm"
input:
module CASApp
# CAS JWT Authentication
class JWTAuthenticatable < Devise::Strategies::Base
HEADER_KEY = 'HTTP_X_TOPTAL_AUTH'.freeze
HEADER_PREFIX = 'Bearer '.freeze
def valid?
header.present?
end
@lowang
lowang / -
Last active March 18, 2016 07:56
586 examples, 4 failures, 15 pending
Failed examples:
rspec ./spec/features/admin/marketing/nokaut/products_commissions_change_spec.rb:13 # Spree::Api::Nokaut::CommissionsController changes commission value
rspec ./spec/models/spree/payment_decorator_spec.rb:36 # Spree::Payment#payment_method_changed_between_switchable validation payment method empty initially should not add errors
rspec ./spec/controllers/spree/admin/cms_image_uploads_controller_spec.rb:82 # Spree::Admin::CmsImageUploadsController POST :create when image save has error returns error in json
rspec ./spec/features/checkout_spec.rb:70 # Checkout and likes to double click buttons prevents double clicking the payment button on checkout
class MySanitizedLogger
def initialize(logger)
@logger = logger
end
def <<(message)
@logger << message.gsub(/password=[^&? "']+/,'password=REDACTED')
end
end
RestClient.log = MySanitizedLogger.new(Logger.new(STDOUT))
class Credentials
@@credentials = {}
class << self
def set_current(credentials)
@@credentials[Thread.current.object_id] = credentials
end
def current
@@credentials[Thread.current.object_id]
end
end
source 'https://rubygems.org'
gem 'activesupport'
gem 'sidekiq'
gem 'pry'
source 'http://rubygems.org'
ruby "1.9.3", :engine => "jruby", :engine_version => "1.7.19"
gem 'torquebox-messaging', '~> 3.1.2', platform: :jruby
gem 'torquebox', '~> 3.1.2', platform: :jruby
m30999| 2015-01-26T14:59:41.936+0100 [Balancer] distributed lock 'balancer/Lowang-MacBook-Pro.local:30999:1422278030:16807' unlocked.
m31102| 2015-01-26T14:59:44.699+0100 [conn210] end connection 192.168.1.220:52935 (4 connections now open)
m31102| 2015-01-26T14:59:44.701+0100 [initandlisten] connection accepted from 192.168.1.220:52951 #213 (5 connections now open)
m31100| 2015-01-26T14:59:46.655+0100 [conn234] end connection 192.168.1.220:52936 (10 connections now open)
m31100| 2015-01-26T14:59:46.656+0100 [initandlisten] connection accepted from 192.168.1.220:52952 #237 (11 connections now open)
m30999| 2015-01-26T14:59:47.945+0100 [Balancer] distributed lock 'balancer/Lowang-MacBook-Pro.local:30999:1422278030:16807' acquired, ts : 54c64853ce5c61cbab9c833b
m30999| 2015-01-26T14:59:47.945+0100 [Balancer] distributed lock 'balancer/Lowang-MacBook-Pro.local:30999:1422278030:16807' unlocked.
m30999| 2015-01-26T14:59:50.723+0100 [LockPinger] cluster Lowang-MacBook-Pro.local:29000 pinged successfully at
source 'https://rubygems.org'
gem 'mongo'
gem 'bson_ext'