Skip to content

Instantly share code, notes, and snippets.

@dduvnjak
dduvnjak / wildfly-install.sh
Last active December 2, 2015 22:46 — forked from sukharevd/wildfly-install.sh
Script to install JBoss Wildfly 10.x as service in Linux
#!/bin/bash
#title :wildfly-install.sh
#description :The script to install Wildfly 10.x
#more :http://sukharevd.net/wildfly-8-installation.html
#author :Dmitriy Sukharev
#date :2015-10-24T17:14-0700
#usage :/bin/bash wildfly-install.sh
#tested-version :10.0.0.CR3
#tested-distros :Debian 7,8; Ubuntu 15.10; CentOS 7; Fedora 22
@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 / 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 / .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
@dduvnjak
dduvnjak / .rdebugrc
Created August 22, 2013 13:36
Quick Ruby debug (thanks to @hkraji)
set autolist
set autoeval
set autoreload
set listsize 20
@dduvnjak
dduvnjak / newrelic.config
Created May 16, 2016 18:26
Installs and configures New Relic System Monitoring agent on AWS Elastic Beanstalk instances
# installs and configures New Relic System Monitoring agent
#
files:
"/opt/elasticbeanstalk/get-eb-env-name.py":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env python
import boto.utils