View appspec.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: | |
- source: files/codedeploy_install_instruction.patch | |
destination: /tmp | |
hooks: | |
AfterInstall: | |
- location: scripts/patch_codedeploy_and_restart.sh | |
timeout: 300 | |
runas: root |
View drachtio-bridge-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Srf = require('drachtio-srf'); | |
const Mrf = require('drachtio-fsmrf'); | |
const config = require('config'); | |
const srf = new Srf() ; | |
const mrf = new Mrf(srf) ; | |
// Connect to drachtio server using SRF - sync | |
srf.connect(config.get('drachtio'), (err, srf) => { | |
if (err) return log_to_console(false, `error connecting to drachtio: ${err}`); | |
}); |
View sample.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const calls = require('./calls'); | |
srf.invite(async(req, res) => { | |
const ms = req.app.locals.ms; | |
const to_number = calls.convertToE164(req.calledNumber); | |
let ep, dlg; | |
try { | |
const {endpoint, dialog} = await ms.connectCaller(req, res); | |
ep = endpoint; | |
dlg = dialog; |
View app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calls = require('./calls') | |
srf.invite((req, res) => { | |
return res.send(500); | |
const ms = req.app.locals.ms; | |
ms.connectCaller(req, res, next) | |
.then(({endpoint, dialog}) => { | |
console.log("Never get here") | |
}); | |
}); // End ms.ConnectCaller |
View app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calls = require('./calls') | |
srf.invite((req, res) => { | |
const ms = req.app.locals.ms; | |
ms.connectCaller(req, res, next) | |
.then(({endpoint, dialog}) => { | |
setHandlers(req, res, dialog, endpoint) | |
to = calls.parseURI(req.msg.headers.to); | |
to_number = calls.convertToE164(to.user) |
View update-all-the-things.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
become: true | |
become_user: "root" | |
become_method: sudo | |
tasks: | |
- name: Enable epel | |
shell: | |
cmd: '/usr/bin/amazon-linux-extras enable epel' | |
- name: Install epel |
View add-ssh-keys-and-root.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
become: true | |
become_user: "root" | |
become_method: sudo | |
tasks: | |
- name: Make .ssh directory | |
file: | |
path: "/root/.ssh" | |
state: directory |
View restart-redis.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z $1 ]; then | |
echo "Syntax is $0 <port>" | |
exit 1 | |
fi | |
if [ -f "/var/run/redis_$1.pid" ]; then | |
#pid=`cat /var/run/redis_$1.pid` | |
# kill -15 $pid | |
redis-cli -p $1 shutdown | |
fi |
View redis-6380.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Redis Server 6380 | |
After=network.target | |
[Service] | |
Type=simple | |
PIDFile=/var/run/redis_6380.pid | |
ExecStart=/usr/local/bin/redis-server /etc/redis/6380.conf | |
ExecStop=/bin/kill -15 $MAINPID | |
Restart=on-failure |
View generate-number-based-on-usec.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pl.stringx' | |
stringx.import() | |
socket = require 'socket' | |
posix = require 'posix' | |
function get_number() | |
return stringx.rjust(tostring(os.date('*t')['sec']) .. tostring(socket.gettime()):split('.',2)[2]:sub(3),4,"0") | |
end | |
for i=1,100 do | |
print(get_number()) |