Skip to content

Instantly share code, notes, and snippets.

Avatar
🇪🇪
Water, earth and air.

Dmitry Polushkin dmitry

🇪🇪
Water, earth and air.
View GitHub Profile
View gist:c0fef7c87041a76589fad9e61bdd521e
WWOOF - http://www.wwoof.org/
Help Exchange http://www.helpx.net/
Global Ecovillage Network ecovillage.org/
View Алег Русак и Алеся Алисиевич - Я Дарю Тебе Мечту
Dm__________Gm
Нежность....Нега...
_________C
Я в тебя плыву,лечу....
F___________________B
Я лучом,дождем и снегом
В твою душу постучу.
Gm
Прошепчу тебе признанье
View gist:b8d741a3862ba950a85aeb04d2d13319
https://fasttext.cc/docs/en/supervised-tutorial.html
https://www.samtalksml.net/aligning-vector-representations/
https://medium.com/@makcedward/from-my-experience-i-just-try-a-magic-number-d4dcc6179ea3
https://habr.com/ru/post/436878/
View weather-rain-estonia.rb
require 'open-uri'
urls = %w(3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 54 60 66 72 84 96 108 120 132 144 156 168 180).map do |i|
"https://www.passageweather.com/maps/baltic/rain/%03d.png" % i
end
`wget #{urls.join(' ')}`
`convert -loop 0 -delay 50 *.png rain.gif`
`rm *.png`
View gist:2117358fc5018d407aee2b0a78486c34
https://answers.microsoft.com/en-us/skype/forum/skype_linux-skype_callms-skype_audioms/skype-for-linux-beta-sound-problem/6ea7f878-5c6c-42b3-bc86-cef605f13397
https://wiki.archlinux.org/index.php/PulseAudio
http://www.pc-freak.net/blog/how-to-fix-pulseaudio-and-skype-crappy-sound-glitches-choppy-sound-and-crackling-on-debian-gnu-linux/
https://askubuntu.com/questions/279407/how-to-disable-microphone-from-auto-adjusting-its-input-volume
@dmitry
dmitry / paperclip_cleanup_undeleted_files.rb
Last active Feb 8, 2018
Cleanup undeleted paperclip files from the filesystem
View paperclip_cleanup_undeleted_files.rb
a = Dir[Rails.root.join('public/system/photos/original/*').to_s]; 1
not_exists = a.map {|v| v.match(/\/([^\/]+)\.[^\/]*\z/).to_a[1].to_i } - Photo.pluck(:id)
not_exists.count
files = Dir[Rails.root.join('public/system/photos/**/*').to_s]; 1
match = Regexp.new("\/(#{not_exists.join('|')})\\.[^\/]*\\z")
matched = files.select {|v| v =~ match }; 1
@dmitry
dmitry / convert_utf8_to_utf8mb4
Last active Jan 22, 2018 — forked from dschneider/convert_utf8_to_utf8mb4
How to easily convert utf8 tables to utf8mb4 in MySQL 5.5
View convert_utf8_to_utf8mb4
# 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'
@dmitry
dmitry / slavmir.fm.rb
Created Jan 17, 2018
Download audio files
View slavmir.fm.rb
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`
View flush-disk.md
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
@dmitry
dmitry / timelapse.sh
Last active Jan 4, 2018
ffmpeg timelapse scripts for sony as300
View timelapse.sh
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
You can’t perform that action at this time.