Skip to content

Instantly share code, notes, and snippets.

View dduvnjak's full-sized avatar

Dario Duvnjak dduvnjak

View GitHub Profile
@dduvnjak
dduvnjak / etherpad_padlist.rb
Last active December 12, 2015 08:18
Simple ruby script to list all Etherpad pads (using etherpad-client and sinatra for web)
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'etherpad-lite'
ETHERPAD_URL = "http://ether.example.com"
client = EtherpadLite.connect(ETHERPAD_URL, 'api_key', '1.2.1')
@dduvnjak
dduvnjak / configure_repo.sh
Last active December 13, 2015 23:09
Repo branch sync
#!/usr/bin/env bash
function usage {
echo "usage: configure_repo.sh [local_repo local_branch remote_repo remote_branch]"
}
local_repo=$1
local_branch=$2
remote_repo=$3
remote_branch=$4
@dduvnjak
dduvnjak / README.md
Last active December 15, 2015 13:19
A Ruby script which spins up a new Ubuntu instance on EC2 and installs java, ant, python and perl on it (all done via Fog). It reads parameters from the config file, but they're overwritable with passed arguments. Can also terminate instances and attach EBS volumes.

Usage:

ruby aws.rb launch [--region region --aws-key aws_key --aws-secret aws_secret --security-group security_group --key-pair key_pair --key-path key_path --ami-id ami_id--flavor-id flavor_id ]  

ruby aws.rb terminate [--region region --aws-key aws_key --aws-secret aws_secret] --instance-id instance_id  

ruby aws.rb attach [--region region --aws-key aws_key --aws-secret aws_secret] --instance-id instance_id --volume-id volume_id
No arguments provided
@dduvnjak
dduvnjak / xrdp_rhel_centos_6.md
Last active August 31, 2022 01:07
Setting up xrdp on RHEL 6

1 - Install the prerequisites for building and installation

yum groupinstall Desktop -y
yum install finger cmake patch gcc make autoconf libtool automake pkgconfig openssl-devel gettext file pam-devel libX11-devel libXfixes-devel libjpeg-devel
yum install flex bison gcc-c++ libxslt perl-libxml-perl xorg-x11-font-utils tigervnc-server git -y
reboot

2 - Get the latest source from the xrdp git repo, build and install

git clone git://github.com/FreeRDP/xrdp.git
@dduvnjak
dduvnjak / awesome_prompt.md
Last active December 16, 2015 11:39
Awesome prompt for bash and fish shell

To make you prompt look like this:

Prompt screenshot

Add this to your ~/.bash_profile

export PS1="\[$(tput setaf 6)\]\u\[$(tput sgr0)\]@\[$(tput setaf 6)\]\h\[$(tput setaf 3)\] \w\n\[$(tput sgr0)\]> "

Or this to your ~/.config/fish/config.fish (create it if it's not there):

@dduvnjak
dduvnjak / README.md
Last active December 17, 2015 06:18 — forked from oodavid/README.md

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

var exec = require('child_process').exec;
function execute(command, callback){
exec(command, function(error, stdout, stderr){ callback(stdout); });
};
module.exports.getUser = function(callback){
execute("whoami", function(name){
callback({ name: name.replace("\n", "") });
});
};
@dduvnjak
dduvnjak / gist:6158333
Created August 5, 2013 18:44
One liner for batch extract of subtitles from MKV. (in this case, subtitles are track #3)
find /path -name "*.mkv" -exec bash -c 'mkvextract tracks "{}" 3:"$(dirname "{}")/$(basename "{}" .mkv).srt"' \;

file directory layout:

|- index.html
|- manifest.appcache
|- static/
|  |- 00786df954089f14eaca25061f454957.svg
|  `- bb796e8931c52593d86ec07a0246e1e6.css
|_ polyfiller/
   `- shims/
@dduvnjak
dduvnjak / .vimrc
Last active December 21, 2015 12:38
Vim syntax highlighting and indentation (.vimrc)
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set expandtab
syntax on
set backspace=indent,eol,start