Skip to content

Instantly share code, notes, and snippets.

View zhum's full-sized avatar

Zhumatiy Sergey zhum

View GitHub Profile
@zhum
zhum / file_uploader.rb
Created July 10, 2019 06:18 — forked from DRBragg/file_uploader.rb
PDF Previews with carrierwave
class ItemUploader < CarrierWave::Uploader::Base
require 'carrierwave/orm/activerecord'
include CarrierWave::RMagick
if Rails.env.test?
storage :file
else
storage :fog
end
@zhum
zhum / ffmpeg.md
Created April 19, 2019 13:29 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

require 'dry-validation'
schema = Dry::Validation.Schema do
required(:field_1).filled(:str?)
required(:field_2).filled(:int?)
rule(field_2_depends_on_field_1: [:field_1, :field_2]) do |field_1, field_2|
field_1.eql?('Foo').then(field_2.eql?(0)) & field_1.eql?('Bar').then(field_2.eql?(1))
end
end
@zhum
zhum / dnsbl.sh
Created November 12, 2017 08:34 — forked from agarzon/dnsbl.sh
DNS Black List - Linux shell script (improved from: http://www.daemonforums.org/showthread.php?t=302)
#!/bin/sh
# Check if an IP address is listed on one of the following blacklists
# The format is chosen to make it easy to add or delete
# The shell will strip multiple whitespace
BLISTS="
bl.score.senderscore.com
bl.mailspike.net
bl.spameatingmonkey.net
b.barracudacentral.org
@zhum
zhum / osmradio.sh
Last active August 29, 2015 14:07 — forked from Zverik/osmradio.sh
#!/usr/bin/sh
# PulseAudio setup for recording osm radio from skype and mic
function rec_start() {
IP=127.0.0.1
PASSWORD=password
DATE=$(date +%y%m%d-%H%M)
# Initializing microphone
MIC_ID=$(pactl list short sources|grep GoMic|grep input|cut -f 1)