Skip to content

Instantly share code, notes, and snippets.

View andrius's full-sized avatar

Andrius Kairiukstis andrius

View GitHub Profile
@andrius
andrius / rails.rb
Created November 27, 2013 16:15 — forked from simi/rails.rb
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
require 'rubygems'
require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'
module Rails
@andrius
andrius / mongodb_keys.rb
Last active December 29, 2015 17:49
Fixes 'not Ok for value' mongo DB error, when key contains '.' (DOT) character
def mongodb_keys(from,to,data)
if data.kind_of? Hash
result = {}
data.each_pair do |k,v|
result[k.to_s.gsub(from, to)] = mongodb_keys(from, to, v)
end
return result
elsif data.kind_of? Array
result = []
data.each do |v|
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
# Start Adhearsion in JRuby, while building a pidfile as soon as possible.
def ahnctl_start
shell_command = "#{exec_ahn_async} && #{wait} && #{save_pid}"
%x{shell_command}
end
private
# Run start in the background, since it is not daemonized.
@andrius
andrius / sip.conf
Last active August 29, 2015 14:04
Asterisk PBX SIP.conf, which works :)
[general]
udpbindaddr=0.0.0.0:5060
tcpenable=yes
tcpbindaddr=0.0.0.0:5060
tlsenable=yes
tlsbinddir=0.0.0.0:5060
;tlsverify=no
@andrius
andrius / 1-odbc.ini
Last active May 28, 2024 22:34
ODBC.ini for Asterisk PBX res_odbc, cdr_odbc and realtime integration #asterisk #odbc
; place this file to /etc (/etc/odbc.ini)
[mysql-asterisk]
Description = MySQL Asterisk database
; MySQL DB name
Database = asterisk
; User
User = asterisk
; Password
@andrius
andrius / install-asterisk-debian.sh
Created August 2, 2014 10:05
Install script for Asterisk PBX on debian
apt-get --yes install curl wget rsync subversion git-core \
build-essential automake autoconf libtool bison libssl-dev openssl libncurses-dev libnewt-dev \
libreadline6 libreadline-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev \
libxslt-dev libc6-dev libcurl4-openssl-dev libgdbm-dev libffi-dev sudo \
libsqlite3-dev sqlite3 libtiff-dev ghostscript usbutils libusb-dev unzip autoconf automake \
minicom mc vim screen tmux libncurses5-dev libxml2-dev libssl-dev uuid-dev \
libpcap-dev ngrep libpcre++-dev libpcre3-dev wpasupplicant w3m ssl-cert ca-certificates \
ffmpeg espeak libespeak-dev libsndfile1-dev libsamplerate0-dev libsrtp0-dev libsrtp0 \
uuid-dev uuid
@andrius
andrius / install-asterisk-32.sh
Last active December 6, 2016 22:59
Install Asterisk with OPUS support on top of FreePBX distro (CentOS 6.5 32-bit!!! + FreePBX 2.1.1)
amportal stop
yum -y update
yum -y groupinstall core && yum install -y tmux patch screen gcc gcc-c++ lynx bison mysql-devel mysql-server sqlite-devel sqlite libsqlite3x-devel php php-mysql php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git subversion kernel-devel php-process crontabs cronie cronie-anacron wget odbc-devel unixODBC unixODBC-devel mysql-connector-odbc libtool libtool-ltdl libtool-ltdl-devel libcurl-devel libogg-devel libvorbis-devel speex-devel freetds-devel net-snmp-devel corosynclib-devel popt-devel lua-devel portaudio-devel libresample-devel neon-devel libical-devel openldap-devel gmime22-devel sqlite2-devel libedit-devel libuuid-devel openssl-devel doxygen kernel-headers-`uname -r` kernel-devel-`uname -r` glibc-headers
cp -R /etc/asterisk /etc/asterisk-backup
yum remove asterisk11*
# yum install libsrtp-devel
cd /usr/src
@andrius
andrius / install-asterisk-64.sh
Last active March 27, 2016 16:45
Install Asterisk with OPUS support on top of FreePBX distro (CentOS 6.5 64-bit!!! + FreePBX 2.1.1)
amportal stop
# install epel repo
yum instll iksemel-devel srtp-devel libsrtp-devel spandsp-devel
yum -y update
yum -y groupinstall core && yum install -y tmux patch screen gcc gcc-c++ lynx bison mysql-devel sqlite-devel sqlite libsqlite3x-devel php php-mysql php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git subversion kernel-devel php-process crontabs cronie cronie-anacron wget odbc-devel unixODBC unixODBC-devel mysql-connector-odbc libtool libtool-ltdl libtool-ltdl-devel libcurl-devel libogg-devel libvorbis-devel speex-devel freetds-devel net-snmp-devel corosynclib-devel popt-devel lua-devel portaudio-devel libresample-devel neon-devel libical-devel openldap-devel gmime22-devel sqlite2-devel libedit-devel libuuid-devel openssl-devel doxygen kernel-headers-`uname -r` kernel-devel-`uname -r` glibc-headers
cp -R /etc/asterisk /etc/asterisk-backu
@andrius
andrius / 1-google-tts-usage.rb
Last active August 29, 2015 14:05
Google TTS
def tts(message, lang = 'en-US')
GoogleTTS.download(message, lang)
end
def read_pin(message, lang = 'en-US')
prompt = { audio: ANNOUNCEMENTS[lang][message],
max_digits: 10,
timeout: 20 }
#3.times do |attempt_no|
data = begin