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 Inputs -------------------------------------------------------------------------------------- | |
[cmdletBinding()] | |
Param( | |
$Path = "C:\usr\documents\msdoc" | |
) #end param | |
$findText = "find specific text" | |
$docs = Get-childitem -path $Path -Recurse -Include *.docx,*.doc | | |
where {$_.LastWriteTime -gt [datetime]"1/1/2000" -AND $_.lastwritetime -le [datetime]"12/31/2020"} | |
#--------------------------------------------------------------------------------------------------- |
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
Sequel.migration do | |
up do | |
create_table(:office_files) do | |
primary_key :id | |
column :uuid, 'uniqueidentifier' | |
String :name | |
Date :created_at | |
File :file # datatype File = blob | |
end | |
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
require 'bcrypt' | |
require 'pp' | |
require 'base64' | |
require 'yaml' | |
require 'ostruct' | |
SECRET = 'my password' | |
puts '********** Base64 (not safe because it produces the same string every time)**********' | |
enc_64_string = "bXkgcGFzc3dvcmQ=\n" |
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
ds_1 = People.select(:birth).select_append{year(:birth).as(:year)} | |
ds_1.first ##<Member @values={:birth=>1980-09-15 00:00:00 -0700, :year=>1980}> | |
ds_2 = People.select(:birth).select_append{(year(:birth) % 100 ).as(:year)} | |
# ds_2.first | |
# NoMethodError: undefined method `%' for #<Sequel::SQL::Function @name=>:year, @opts=>{}, @args=>[:birth]> | |
# Mostly because it is less common. It's defined in BitwiseMethods, which is only included in NumericExpression by default. | |
# Some of the BitwiseMethods overlap with the BooleanMethods that are included in GenericExpression. |
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 'uri' | |
require 'pp' | |
require 'pathname' | |
url = URI('http://66.55.135.155:8000/Channel1') | |
##### VLC ##### | |
stop_time = ARGV.shift # duration in secords | |
abort 'no stop tiime defined' unless stop_time |
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 'sequel' | |
require 'csv' | |
csv_records = CSV.read('records.csv') | |
DB = Sequel.connect('jdbc:sqlite::memory:') | |
DB.create_table(:records) do | |
Integer :id, :primary_key => true | |
String :member_id, :null => false |
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 'bcrypt' | |
require 'pp' | |
secret = 'my password' | |
BCrypt::Engine.cost = 4 # default is 10 | |
password = BCrypt::Password.create(secret) | |
puts '********** create **********' | |
puts ['version:', password.version].join(' ') |
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
DB = Sequel.connect('jdbc:sqlite::memory:') | |
DB.create_table(:categories) do | |
Integer :id, :primary_key => true | |
foreign_key :parent_id, :categories | |
String :name, :null => false | |
end | |
DB[:categories].import([:id, :parent_id, :name], [[1, nil, 'GPS'], [2, 1, 'Vehicle GPS'], [3, 1, 'Handheld GPS'], [4, nil, 'GPS Accessories']]) | |
DB.create_table(:products) do |
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
source 'https://rubygems.org' | |
gem 'jdbc-sqlite3', :platform => :jruby | |
gem 'sequel' |
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 'securerandom' | |
SecureRandom.urlsafe_base64(8) |
NewerOlder