openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero | pv -pterb > /dev/sdb
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
# For each database: | |
ALTER DATABASE century21_development CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; | |
# For each table: | |
SELECT CONCAT('ALTER TABLE `', TABLE_NAME,'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') AS mySQL FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA= "century21_development" | |
# For each column: | |
select CONCAT('ALTER TABLE `', TABLE_SCHEMA, '.', TABLE_NAME,'` CHANGE ',COLUMN_NAME,' ', COLUMN_NAME, ' ', DATA_TYPE,'(',CHARACTER_MAXIMUM_LENGTH,') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') as column_alter from INFORMATION_SCHEMA.COLUMNS WHERE DATA_TYPE IN('varchar', 'text') AND TABLE_SCHEMA = 'century21_development' |
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 'open-uri' | |
require 'nokogiri' | |
domain = 'https://slavmir.fm' | |
Nokogiri::HTML(open(domain + '/blogs/programmy')).css('.article_preview').to_a.each do |v| | |
url = domain + v.attributes['href'].value | |
Nokogiri::HTML(open(url)).css('.track-play').to_a.each do |z| | |
`curl "#{z.attributes['data-play-music'].value}" -O` |
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
for FILE in `ls *.JPG`; do \ | |
mogrify -resize 1920x -write resized/$FILE $FILE; \ | |
done | |
for FILE in `ls *.JPG`; do \ | |
mogrify -resize 1920x1080^ -gravity center -crop 1920x1080+0+0 +repage -write resized/$FILE $FILE; \ | |
done | |
for i in $(ls *.JPG); do exiv2 -r '%Y%m%d.%H%M%S' rename $i; done |
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
module SortItemsExtension | |
def sort_items(ids) | |
unless ids.is_a?(Array) | |
raise ArgumentError, "ids isn't an array" | |
end | |
ids.map!(&:to_i) | |
old_ids = proxy_association.ids_reader | |
ids = ids - (ids - old_ids) |
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
(0..24).to_a.map do Thread.new do 0.upto(20000) do |i| ActiveRecord::Base.connection.execute("SELECT * FROM properties WHERE #{i}=#{i} LIMIT 1").to_a end end end.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
body { | |
animation-duration: 0.001s; | |
} | |
@media screen and (min-width: 769px) { | |
body { | |
animation-name: media-table; | |
} | |
} | |
@media screen and (max-width: 768px) { | |
body { |
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 :test do | |
run 'echo #{bundle_cmd}' | |
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
var value = 1; | |
var c = days.length; | |
for (var i = 0; i < c; i++) { | |
var v = _source.minimum_stays[days[i]]; | |
if (v && value < v) { | |
value = v; | |
} | |
} | |
if (value == 1) { | |
value = _source.minimum_nights |