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
class Post < ActiveRecord::Base | |
class << self | |
def get_column(column) | |
columns.select do |column_| | |
column_.name == column.to_s | |
end[0] | |
end | |
def any(what) | |
out = all |
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/sh | |
my_ips="192.168.1.2|192.168.1.3" | |
plex_ports="32400|32410|32412|32413|32414|32469" | |
ip_list=$(ipset list plex -s |sed -rn '/192\.168\.1/p' |tr "\n" "|") | |
ip_list=${ip_list%?} | |
set -e | |
if netstat --numeric-ports --numeric-hosts --inet -p |grep -P "tcp\s+0\s+([1-9][0-9]+)\s+(${my_ips}):(${plex_ports})\s+(${ip_list}):\d+\s+ESTABLISHED\s+\d+/Plex" >/dev/null | |
then exit 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
def clean_for_action_based_url(url) | |
CGI.unescape(url || ""). | |
gsub(/\/+/, "/"). | |
tr('^a-z_-/', "") | |
end | |
def clean_url(url) | |
url = CGI.unescape(url || "") | |
url = url.gsub(/\A((https?:)?\/+)*/, "").gsub(/\/+/, "/") | |
url.split("/").map { |v| CGI.escape(v) }. |
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 'action_dispatch/middleware/session/abstract_store' | |
require 'rack/session/abstract/id' | |
module ActionDispatch | |
module Session | |
class RedisStore < Rack::Session::Abstract::ID | |
include StaleSessionCheck | |
include Compatibility | |
attr_reader :server |
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 'action_dispatch/middleware/session/redis_store' | |
module ActionDispatch | |
module Session | |
class SignedRedisStore < ActionDispatch::Session::RedisStore | |
def load_session(env) | |
stale_session_check! do | |
get_session(env, | |
cookie_jar(env)[@key] | |
) |
NewerOlder