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
# Your Assignment: | |
# (easy) First, print the numbers 1 to 10 in the console | |
puts "1. ---------------" | |
(1..10).each do |i| | |
puts i | |
end | |
# (medium) Second, Write a method that takes an array [-4,-76, 64, 200, -2, 644] and only prints positive integers |
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
page.css('p').text.split(/(.)/).each_slice(2).map(&:join) |
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 DATE_SUB(curdate(), INTERVAL 2 WEEK) | |
-- Space consumed by databases | |
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema; | |
-- Free space available | |
SELECT table_schema "Database Name", sum( data_length + index_length ) / 1024 / 1024 "Database Size in MB", sum( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES GROUP BY table_schema; |
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 * from INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME like '%Datasource%' |
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 TABLE_NAME from INFORMATION_SCHEMA.TABLES | |
WHERE TABLE_NAME LIKE'%cliff%' |
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
namespace :export do | |
desc "Prints Country.all in a seeds.rb way." | |
task :seeds_format => :environment do | |
Country.order(:id).all.each do |country| | |
puts "Country.create(#{country.serializable_hash.delete_if {|key, value| ['created_at','updated_at','id'].include?(key)}.to_s.gsub(/[{}]/,'')})" | |
end | |
end | |
end | |
#via http://xyzpub.com/en/ruby-on-rails/3.2/seed_rb.html |
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
#!/bin/bash | |
set -o nounset | |
set -o errexit | |
<<COMMENT | |
via http://robertmuth.blogspot.com/2012/08/better-bash-scripting-in-15-minutes.html | |
To perform a syntax check/dry run of your bash script run: | |
bash -n myscript.sh |
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
var p=/.*(regu).+?\ /gi; console.log( document.body.innerText.match(p) ); |
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
LOAD DATA INFILE '/tmp/stats-2014.csv' | |
INTO TABLE orig_stats | |
FIELDS TERMINATED BY ',' | |
LINES TERMINATED BY '\r\n' | |
IGNORE 1 LINES ; |
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
/* via http://stackoverflow.com/questions/7048839/sql-server-query-to-find-all-permissions-access-for-all-users-in-a-database | |
Security Audit Report | |
1) List all access provisioned to a sql user or windows user/group directly | |
2) List all access provisioned to a sql user or windows user/group through a database or application role | |
3) List all access provisioned to the public role | |
Columns Returned: | |
UserName : SQL or Windows/Active Directory user cccount. This could also be an Active Directory group. | |
UserType : Value will be either 'SQL User' or 'Windows User'. This reflects the type of user defined for the | |
SQL Server user account. |
OlderNewer