Skip to content

Instantly share code, notes, and snippets.

View gdm's full-sized avatar

Dmytro Gorbunov gdm

View GitHub Profile
for FILE in *.webm; do
echo -e "Processing video '\e[32m$FILE\e[0m'";
ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3";
done;
# find . -type f -iname "*.webm" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3";' _ '{}' \;
@gdm
gdm / vim-tricks.txt
Created May 13, 2018 20:46
VIM tricks
Change file encoding(helps with some errors in utf-8 encoding) :e ++enc=utf8
@gdm
gdm / davpush.pl
Created February 18, 2018 23:02
Uploads all files and folders recursively to the WebDAV folder passed in the url
#!/usr/bin/perl
use File::Find;
my $script = "";
sub wanted() {
my $f = $File::Find::name;
if (-f $f) {
$script .= "put '$f'\n";
} else {
#!/bin/bash -xe
# for
PASS=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)');
sed -i "s/^password =.*$/password = ${PASS}/" /etc/mysql/debian.cnf
sed -i "s/^user =.*$/user = debian-sys-maint/" /etc/mysql/debian.cnf
mysql -e "GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '${PASS}' WITH GRANT OPTION;"
@gdm
gdm / luksloopback.sh
Last active September 28, 2017 19:47 — forked from dbehnke/luksloopback.sh
luks encryption with loopback file
#!/bin/bash -xe
loopdevice=/dev/loop0
loopfile=/root/crypt.loop
#megabytes
loopsize=256
#/dev/mapper/xxxxx when open
cryptmapper=crypt
#!/bin/bash
#===============================================================================
#
# FILE: convert.sh
#
# USAGE: ./convert.sh
#
# DESCRIPTION: convert mp4 to mp3
#
# OPTIONS: ---
#!/bin/bash
rm -rf dumps
mkdir -p dumps
CRED=
# CRED=-u $USER -p$PASSWORD
OPTS="--single-transaction --quick"
#rm "$OUTPUTDIR/*gz" > /dev/null 2>&1
@gdm
gdm / jobs.js
Last active December 20, 2016 09:51 — forked from maximilianschmitt/jobs.js
Automated MySQL backups to S3 with node.js
'use strict';
var mysqlBackup = require('./mysql-backup');
var schedule = require('node-schedule');
schedule.scheduleJob({ hour: 22, minute: 0 }, mysqlBackup);
@gdm
gdm / nginx.conf
Created December 14, 2016 14:02 — forked from cpswan/nginx.conf
Using nginx to proxy to an AWS ELB
daemon off;
worker_processes 1;
events { worker_connections 1024; }
http{
sendfile on;
@gdm
gdm / nginx.conf
Created November 2, 2016 01:11 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048