Skip to content

Instantly share code, notes, and snippets.

XavM

Block or report user

Report or block XavM

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@XavM
XavM / gist:78bac54fd17a1870016342df7894ed64
Created Apr 25, 2019
[Safari only] "transceiverRequest" sent in a loop when the non initiator ".addStream"
View gist:78bac54fd17a1870016342df7894ed64
<!DOCTYPE html>
<html lang="en" >
<head>
<script src="https://cdn.jsdelivr.net/gh/feross/simple-peer@c5f8a8ded50ef354d5a0f8a3700f8817565ed032/simplepeer.min.js"></script>
</head>
<body>
<button id="startVideoPeer1">Start Video Chat Peer1</button>
@XavM
XavM / Install_zbo-goimporter.md
Created Oct 18, 2016
Build zbo-goimporter from scratch using Docker
View Install_zbo-goimporter.md

Build zbo-goimporter from scratch (using Docker)

Run a fresh build CT

CT_ID=$(docker run -itd centos /bin/bash)

Enter CT

@XavM
XavM / Install_zbo-ana.md
Last active Aug 30, 2016
Build zbo-ana from scratch using Docker
View Install_zbo-ana.md

Build zbo-ana from scratch (using Docker)

Run a fresh build CT

CT_ID=$(docker run -itd centos /bin/bash)

Enter CT

@XavM
XavM / curl
Created Mar 25, 2016
Pipe any thing to curl's stdin to be http requested, but "flush" curl's stdin every Nth request
View curl
## cUrl, used with "-K -", reads the config from the stdin, but waits for stdin's EOF before executing any HTTP requests
## See : http://comments.gmane.org/gmane.comp.web.curl.general/15001
## Using the split's filter options allows starting and piping a stream to a new curl's stdin every N requests
## A same connexion can be kept alive for those N requests, making perfs much much better
## TODO : Find a way to parallelise several curl in a "xargs -P" way
## Example : (the for loop is there to simulate some real stream, and to demonstrate the curl's required format)
@XavM
XavM / gist:12b092eb101a347fdcd2
Created Mar 7, 2016
bash job pool for // execution
View gist:12b092eb101a347fdcd2
#!/bin/bash
debug=0;
## Clean up working temp files
function clean_up {
((debug)) || rm -rf "${path_to_file}"
}
trap clean_up EXIT
@XavM
XavM / vps.mount
Created Nov 4, 2015
Containers and Service auto registration through Consul for openVZ CT (via ovz action scripts)
View vps.mount
#!/bin/bash
set -eo pipefail
CONSUL_EP="IP:PORT"
main() {
# Exit when required files are not present
[[ -f /etc/vz/vz.conf ]] || exit 1
@XavM
XavM / crtct
Created Nov 4, 2015
Create an openVZ CT
View crtct
#!/bin/bash
## Fail fast and be aware of exit codes
set -eo pipefail
# Guess unused CTID, by increasing the last one
get_ct_id() {
#local ctid=$(/usr/sbin/vzlist -H -a -octid \
# 2>/dev/null | tail -1)
#[ -n "$ctid" ] || ctid=100
@XavM
XavM / gist:cb987bb0502305985faa
Last active Dec 3, 2015
Clone a (ploop) openVZ CT with base image dedup
View gist:cb987bb0502305985faa
#!/bin/bash
# Clone a (ploop) openVZ CT with base image dedup
# Ex : ./vzclone $CTID | xargs vzctl start
set -eo pipefail
if [ -z $1 ]; then
>&2 echo "Usage: vzclone CTID"
exit 1
@XavM
XavM / vztmpl-cr
Last active Sep 2, 2016
Create an openVZ template (tar ball) from a running CT
View vztmpl-cr
#!/bin/bash
## Create an openVZ template (tar ball) from a running CT
set -eo pipefail
if [ -z $1 ]
then
echo "Usage: vztmpl-cr CTID [NAME]"
exit 1
@XavM
XavM / gist:b3032be9f38e4cdf4f82
Last active Aug 29, 2015
dhcp_ct : A "dhcp like" client written in bash and relying on consul catalog (Requires curl, jq, ping and ... consul)
View gist:b3032be9f38e4cdf4f82
#!/bin/bash
#############
## dhcp_ct : A "dhcp like" client written in bash and relying on consul catalog (Requires curl, jq and ... consul)
## Usage : $> ./dhcp_ct datacenter host_name_prefix ip_pool
## Ex : $> ./dhcp_ct dc1 ct 192.168.0.{1..254} # <- Would register a new node in consul catalog using a free IP and HOSTNAME
## STDOUT : ct1 192.168.0.88
#############
## Fail fast and be aware of exit codes
You can’t perform that action at this time.