Skip to content

Instantly share code, notes, and snippets.

@lkfken
lkfken / password_salt.rb
Created May 8, 2017 23:52
To demostrate how to add/use salt on password
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"
@lkfken
lkfken / 001_msoffice_files.rb
Created June 21, 2017 00:04
Ruby Sequel Blob datatype
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
@lkfken
lkfken / SearchTextInWord.ps1
Last active October 13, 2017 17:52
Search docx files that contain the given text in a given folder
# 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"}
#---------------------------------------------------------------------------------------------------