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
SELECT t2.* FROM ((SELECT username FROM radcheck GROUP BY username LIMIT 4) AS t1) JOIN (radcheck as t2) ON t1.username = t2.username; |
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
md5_w_salt = Base64.encode64(Digest::MD5.digest('saltedpass' + 'salt') + 'salt').chomp! | |
random_binary_str = (Array.new(16){ rand(0x100) }).pack('c*') |
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
# Use ObjectSpace.define_finalizer, as | |
# inspired by the Ruby std library (tmpfile.rb) | |
class C | |
def initialize | |
@child_pid = fork do | |
sleep 1000 | |
end | |
Process.detach(@child_pid) if @child_pid | |
ObjectSpace.define_finalizer self, Killer.new(@child_pid) | |
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 'pp' | |
class Object | |
def deep_map_values(&block) | |
if respond_to? :each_pair | |
out = {} | |
each_pair do |k, v| | |
out[k] = v.deep_map_values(&block) | |
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 'ipaddr' | |
require 'pp' | |
module ConfigFiles | |
class Parameter | |
attr_accessor :name, :properties | |
def is(*args) | |
@properties = args if args.length > 0 | |
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
# parse dar -l | |
# | |
# list directory | |
p Time.now | |
IO.popen('dar -l files -K "bf:o"', 'r').each_line do |line| | |
line.force_encoding 'ASCII-8BIT' | |
if line =~ /^(\[[^\[\]]+\])\s+(\[[^\[\]]+\])\s+([-\w])([-\w]{9})\s+(\S+)\s+(\S+)\s+(\d+)\s+(\w{3} \w{3} \d+ \d\d:\d\d:\d\d \d\d\d\d)\s+(\S.*\S)\s*$/ | |
saved, comp, type, perms, u, g, size, mtime, path = |
NewerOlder