Skip to content

Instantly share code, notes, and snippets.

@rdkls
rdkls / Nginx RTMP publish from FFMPeg - Tshark
Created December 13, 2013 04:00
1.2.3.4 = Nginx + RTMP, 9.10.11.12 = My client (publishing via ffmpeg)
0.000000 9.10.11.12 -> 1.2.3.4 TCP 78 40420 > macromedia-fcs [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=16 TSval=2718096021 TSecr=0 SACK_PERM=1
0.000053 1.2.3.4 -> 9.10.11.12 TCP 74 macromedia-fcs > 40420 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=171744276 TSecr=2718096021 WS=32
0.163405 9.10.11.12 -> 1.2.3.4 TCP 66 40420 > macromedia-fcs [ACK] Seq=1 Ack=1 Win=131760 Len=0 TSval=2718096183 TSecr=171744276
0.163943 9.10.11.12 -> 1.2.3.4 TCP 1514 40420 > macromedia-fcs [ACK] Seq=1 Ack=1 Win=131760 Len=1448 TSval=2718096183 TSecr=171744276
0.163962 1.2.3.4 -> 9.10.11.12 TCP 66 macromedia-fcs > 40420 [ACK] Seq=1 Ack=1449 Win=17376 Len=0 TSval=171744317 TSecr=2718096183
0.163969 9.10.11.12 -> 1.2.3.4 RTMP 155 Handshake C0+C1
0.163976 1.2.3.4 -> 9.10.11.12 TCP 66 macromedia-fcs > 40420 [ACK] Seq=1 Ack=1538 Win=17376 Len=0 TSval=171744317 TSecr=2718096183
0.164149 1.2.3.4 -> 9.10.11.12 TCP 1514 macromedia-fcs > 40420 [ACK] Seq=1 Ack=1538 Win=17376 Len=1448 TSval=171744317 TSecr=2
@rdkls
rdkls / Wowza RTMP publish from Envivio - Tshark
Created December 13, 2013 07:07
1.2.3.4 = Wowza, 5.6.7.8 = Envivio
0.000000 5.6.7.8 -> 1.2.3.4 TCP 62 snmp-tcp-port > macromedia-fcs [SYN] Seq=0 Win=65535 Len=0 MSS=1387 SACK_PERM=1
0.000028 1.2.3.4 -> 5.6.7.8 TCP 62 macromedia-fcs > snmp-tcp-port [SYN, ACK] Seq=0 Ack=1 Win=14600 Len=0 MSS=1460 SACK_PERM=1
0.001574 5.6.7.8 -> 1.2.3.4 TCP 60 snmp-tcp-port > macromedia-fcs [ACK] Seq=1 Ack=1 Win=65535 Len=0
0.002216 5.6.7.8 -> 1.2.3.4 RTMP 1591 Handshake C0+C1
0.002231 1.2.3.4 -> 5.6.7.8 TCP 54 macromedia-fcs > snmp-tcp-port [ACK] Seq=1 Ack=1538 Win=16644 Len=0
0.004416 1.2.3.4 -> 5.6.7.8 TCP 2828 macromedia-fcs > snmp-tcp-port [ACK] Seq=1 Ack=1538 Win=16644 Len=2774
0.004430 1.2.3.4 -> 5.6.7.8 RTMP 353 Handshake S0+S1+S2
0.006482 5.6.7.8 -> 1.2.3.4 TCP 60 snmp-tcp-port > macromedia-fcs [ACK] Seq=1538 Ack=2775 Win=65535 Len=0
0.007128 5.6.7.8 -> 1.2.3.4 RTMP 1590 Handshake C2
0.007141 1.2.3.4 -> 5.6.7.8 TCP 54 macromedia-fcs > snmp-tcp-port [ACK] Seq=3074 Ack=3074 Win=19418 Len=0
key_as_hex=$(cat ../static.key | hexdump -e '16/1 "%02x"')
for i in {0..5}; do
fn_in=../../martha/fileSequence${i}.ts
fn_flip=fileSequence.flip.${i}.ts
fn_enc=fileSequence.enc.${i}.ts
ffmpeg -y -i $fn_in -filter vflip $fn_flip
init_vector=`printf '%032x' $i`
openssl aes-128-cbc -e -in $fn_flip -out fileSequence.enc.$(($i)).ts -p -nosalt -iv $init_vector -K $key_as_hex
# ElasticSearch Service
description "ElasticSearch"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
@rdkls
rdkls / gist:9104936
Created February 20, 2014 01:05
Ansible tasks to set (aka register) a variable, based on stdout of a shell command
- name: get gridfs host ip from name (required for nginx gridfs module)
shell: 'ping -q -c 1 -t 1 {{ gridfs_host }} | grep PING | sed -e "s/).*//" | sed -e "s/.*(//"'
register: gridfs_ip_command
when: gridfs_ip is not defined
- name: set gridfs ip
set_fact: gridfs_ip={{ gridfs_ip_command.stdout }}
when: gridfs_ip is not defined
@rdkls
rdkls / backup
Created February 24, 2014 02:17
duplicity backup script
#!/bin/bash
export FTP_HOST=YOUR_HOST_HERE
export FTP_USER=YOUR_USERNAME_HERE
export FTP_PASSWORD=YOUR_PASSWORD_HERE
export PASSPHRASE=YOUR_PASSPHRASE_HERE
export SIGN_PASSPHRASE=YOUR_SIGN_PASSPHRASE_HERE
usage='Usage: backups [list|ftp|retrieve|ship|restore]'
duplicity=/usr/bin/duplicity
@rdkls
rdkls / fog creek job prob
Last active August 29, 2015 14:01
My python solution to the problem on the Fog Creek job app page http://www.fogcreek.com/Jobs/Dev/
#!/usr/bin/python
the_letters = 'acdegilmnoprstuw'
target_hash = 910897038977002
target_word_length = 9
def possible_strings(given_hash, string_so_far=''):
try:
given_hash = float(given_hash)
except ValueError:
raise Exception('Hash must be a number')
@rdkls
rdkls / bonnie.log
Last active December 21, 2017 01:31
benchmarking storage types on aws ec2 ebs-optimized instance c3.xlarge
# ephemeral = instance
[root@ip-172-31-28-224 ec2-user]# bonnie++ -d /media/ephemeral0/ -n0 -s4G -r512M -f -b -u root
Using uid:0, gid:0.
Writing intelligently...
done
Rewriting...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Version 1.96 ------Sequential Output------ --Sequential Input- --Random-
@rdkls
rdkls / httpshark.sh
Last active February 10, 2018 05:58
http dump with tshark
tshark -V -R "tcp.port == 8080 && (http.request || http.response)" | awk "/Hypertext Transfer Protocol/,/Frame/ { print };/Transmission Control Protocol/{print};/Internet Protocol/{print}"
@rdkls
rdkls / generate-schema.cql
Last active March 8, 2018 00:59
neo4j create schema based on existing nodes
// Generate an overview / schema of a graph database
// Creates a node for each node label found in the graph,
// relating these to each other for each type of relationship found in the graph
// (apoc call required to create rel with dynamic type)
MATCH (a)-[r]->(b)
WITH head(labels(a)) AS l, head(labels(b)) AS l2, type(r) AS rel_type, count(*) as num_links
merge (aMeta:Meta {label: l})
merge (bMeta:Meta {label: l2})
with aMeta, bMeta, rel_type, num_links
call apoc.create.relationship(aMeta, rel_type, {num_links: num_links}, bMeta) yield rel