Skip to content

Instantly share code, notes, and snippets.

View zhum's full-sized avatar

Zhumatiy Sergey zhum

View GitHub Profile
@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)
@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
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 / 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:

@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

Summary

Опиши в 3-4 предложениях что происходило и почему. Это информативное представление о факапе с высоты птичьего полета, оно должно быть понятно любому человеку без контекста.

Ущерб

Качественная оценка Какая функциональность не работала, насколько долго, у кого. Была ли потеря или порча данных. Выбери поле справа.

Количественная оценка

@zhum
zhum / sqlite2pg.sh
Last active January 5, 2020 08:20 — forked from eclubb/sqlite2pg.sh
Script to import SQLite3 database into PostgreSQL
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3
@zhum
zhum / xcat-install.sh
Created February 18, 2020 07:00 — forked from vlj91/xcat-install.sh
xCAT install (CentOS 7)
#!/bin/bash
cat << EOF > /etc/yum.repos.d/xCAT-core.repo
[xcat-2-core]
name=xCAT 2 Core packages
baseurl=http://xcat.org/files/xcat/repos/yum/2.13/xcat-core
enabled=1
gpgcheck=1
gpgkey=http://xcat.org/files/xcat/repos/yum/2.13/xcat-core/repodata/repomd.xml.key
EOF
user www-data;
worker_processes auto;
pid /run/nginx/nginx.pid; # only line changed from default
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
@zhum
zhum / 20-natural-scrolling.conf
Created July 20, 2020 04:46 — forked from kakra/20-natural-scrolling.conf
xorg.conf.d/20-natural-scrolling.conf
Section "InputClass"
Identifier "Enable natural scrolling by default"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
MatchDriver "libinput"
Option "NaturalScrolling" "on"
EndSection