Skip to content

Instantly share code, notes, and snippets.

@benasse
benasse / shellhub-agent-init
Last active October 9, 2022 11:29
shellhub-agent-init
#! /bin/sh
### BEGIN INIT INFO
# Provides: shellhub-agent
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: manage shellhub-agent
### END INIT INFO
@benasse
benasse / amid-action.py
Created July 18, 2022 15:26
lanch amid action on wazo
#!/usr/bin/env python
import logging
import os
import string
import sys
from wazo_auth_client import Client as AuthClient
from xivo.chain_map import ChainMap
from xivo.config_helper import read_config_file_hierarchy, parse_config_file
@benasse
benasse / gist:159920e78bb1ae9ea4c8e17d3497ced9
Last active August 4, 2021 06:52
asterisk pjsip count user agent
rasterisk -rx 'database show' |grep -F '/registrar/contact/' | awk -v FS="({|})" '{print $2}' | sed 's/$/}/' | sed 's/^/{/' | jq .user_agent |sort|uniq -c
@benasse
benasse / dimmer-z2m.yaml
Last active January 12, 2021 22:24
MQTT - Philips Hue Dimmer - bis
blueprint:
name: MQTT - Philips Hue Dimmer
description: 'Control lights with a Philips Hue Dimmer Switch.
The top "on" button will turn the lights on to the last set
brightness.
Dim up/down buttons will change the brightness using predefined
#!/usr/bin/python3
from wazo_auth_client import Client as Auth
from wazo_confd_client import Client as Confd
# Please add a web service user with acl confd.#
# To use ./add-webrtc-line
username = "sylvain" # Fill with your username
password = "sylvain" # Fill with your password
[general]
stunaddr = stun.wazo.io:443
stunrefresh = 30
#!/usr/bin/env python3
import os
import sys
from wazo_confd_client import Client
TOKEN = os.getenv('TOKEN')
c = Client('localhost', verify_certificate=False, token=TOKEN)
conferences = []
@benasse
benasse / add-webrtc-line.py
Last active February 8, 2021 11:39 — forked from sduthil/add-webrtc-line.py
Add Wazo webrtc lines to users that don't have any an UC and CRM subscription
#!/usr/bin/python3
# Copyright 2020 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from wazo_auth_client import Client as Auth
from wazo_confd_client import Client as Confd
# Please add a web service user with acl confd.#
# in order to use ./add-webrtc-line
#!/bin/bash
RECORD='ip-10-252-91-139.eu-west-2.compute.internal'
echo 'DATE;TIME_CMD_ELAPSED;SERVER;HEADER;TIME_DIG'
while true; do
date_log=$(date +%Y-%m-%d\ %H\:%M\:%S)
timestamps_start=$(date +%s%3N)
test_resolution=$(dig @127.0.0.1 "${RECORD}" +retry=0 +timeout=1)
#!/usr/bin/python3
import sys, socket, time
host = "outscale.com"
service = "http"
family = socket.AF_UNSPEC
socktype = socket.SOCK_STREAM
protocol = socket.SOL_TCP
flags = 0