Skip to content

Instantly share code, notes, and snippets.

View kevintyll's full-sized avatar

Kevin Tyll kevintyll

  • Evident.io
  • Tampa, FL
View GitHub Profile
@kevintyll
kevintyll / startup.lua
Last active January 19, 2024 14:47
Vera luup startup functions
local rblt = require("RBLuaTest")
rbLuaTest = rblt.rbLuaTest
luup.register_handler("rbLuaTest","LuaTest")
HOUSE_MODE_PLUGGIN = 40
HOME = '1'
AWAY = '2'
NIGHT = '3'
VACATION = '4'
class Pastie
PastieError = Class.new(StandardError)
ServiceNotAvailable = Class.new(PastieError)
LanguageNotSupported = Class.new(PastieError)
InvalidScope = Class.new(PastieError)
SCOPE = %w{ public private }
LANGUAGE = %w{java ruby cplusplus}
the document to be posted to pastie.org
attr_accessor :document, :scope, :src_type
#Tasks have been added to fully maintain nginx, unicorn, redis, memcached, start resque workers and run any command on any server in the farm.
#<pre>
#cap nginx:restart # Restart Nginx.
#cap nginx:start # Start Nginx.
#cap nginx:status # Status of Nginx.
#cap nginx:stop # Stop Nginx.
#cap nginx:tail_error # Tail the Nginx error logs.
#cap unicorn:reload # reload your unicorn servers.
#cap unicorn:restart # restart your unicorn servers.
#cap unicorn:start # start your unicorn servers.
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
#This will store the PeriodicalExecuter in a variable. In order to set
#the name of the variable, you can pass in a :variable option. By
#default, it will use 'poller'.
#
#So you can do:
#
#periodically_call_remote(:url => some_url, :update => 'some_div',
#:variable => 'my_var')
#
#And when you want to stop the polling, you can inject the following line
module ActiveRecord
# This override allows for validation methods to provide warnings on attributes, as well as errors. Use this
# to provide friendly warnings to your users when your business rules change, prior to turning on the new validations
# and preventing your customers from saving records before they have a chance to change their system.
#
# Every AR object will now have 2 collections +record.errors+ and +record.warnings+.
#
# To set warnings, just add the +:level => :warning+ option to any validation method.
#
uri = URI.parse(@file_path_or_url)
request = Net::HTTP::Get.new(uri.request_uri)
request.basic_auth(SsnValidator::Ntis.user_name,SsnValidator::Ntis.password)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.port == 443)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.request(request)