Skip to content

Instantly share code, notes, and snippets.

Avatar

Whitey WhiteyDude

  • Australia
View GitHub Profile
@WhiteyDude
WhiteyDude / appspec.yml
Last active Jul 25, 2020
CodeDeploy ruby 2.5+ non empty directories fix
View appspec.yml
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
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
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
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
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
---
- 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
---
- 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
#!/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
[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
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())
You can’t perform that action at this time.