Skip to content

Instantly share code, notes, and snippets.

View j1elo's full-sized avatar

Juan Navarro j1elo

View GitHub Profile
@j1elo
j1elo / sdp-preferred-codec.java
Last active August 27, 2020 18:34
SDP preferred codec reordering
/*
* `codec` is a uppercase SDP-style codec name: "VP8", "H264".
*
* This looks for all video m-sections (lines starting with "m=video"),
* then searches all of its related PayloadTypes trying to find those which
* correspond to the preferred codec. If any is found, they are moved to the
* front of the PayloadTypes list in the m= line, without removing the other
* codecs that might be present.
*
* If our preferred coded is not found, the m= line is left without changes.
@j1elo
j1elo / sdp-offer-chrome-84.txt
Created August 27, 2020 17:53
SDP Offer (Chrome 84)
v=0
o=- 5217540180782877494 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS eEMVYR4txYWGErUa55KnHm0mMBdfrqSbtQul
m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:RWim
@j1elo
j1elo / sdp-offer-firefox-79.txt
Created August 27, 2020 17:59
SDP Offer (Firefox 79)
v=0
o=mozilla...THIS_IS_SDPARTA-79.0 1574413241511582424 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 43:63:A0:1A:D4:F3:6A:0B:B9:DC:AD:8B:A4:20:22:17:B9:BD:FC:81:9F:EC:E9:46:E0:61:3B:8B:2A:05:9A:D9
a=group:BUNDLE 0 1
a=ice-options:trickle
a=msid-semantic:WMS *
m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101
@j1elo
j1elo / sdp-offer-safari-13.1.txt
Last active August 27, 2020 18:03
SDP Offer (Safari 13.1)
v=0
o=- 4920969914039852086 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1
a=msid-semantic: WMS 90c21009-8d9f-4b31-8091-d98deb8361c8
m=audio 61842 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 105 13 110 113 126
c=IN IP4 192.168.1.105
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:2222700650 1 udp 2113937151 192.168.1.105 61842 typ host generation 0 network-cost 999
@j1elo
j1elo / github-merge.md
Created September 14, 2020 22:47
GitHub merge branch or PR
@j1elo
j1elo / HttpPostServer.py
Last active November 3, 2020 19:01
Sample HTTP POST server written with Python
# Run command:
#
# $ python3 HttpPostServer.py
#
# Test POST with a complete file:
#
# $ curl --data-binary "@small_file.bin" "http://127.0.0.1:8080/small.bin"
#
# Test POSTing a file progressively (chunked mode):
#
@j1elo
j1elo / cit0day-breach-check.sh
Created November 19, 2020 12:58
Cit0Day Breach Check
#!/bin/bash
# Step 1: Obtain a list of our personal hosts.
# Export from Bitwarden, LastPass, 1Password, or similar:
my_passwords.txt
# Next commands will assume the LastPass export format, which is CSV with the URL in the first field:
# url,username,password,[... more fields]
@j1elo
j1elo / 00-README.md
Created February 9, 2021 10:03 — forked from tdryer/00-README.md
How Linux approximates memory metrics

How Linux approximates memory metrics

Example

The program threads-memory.c (included below) starts 100 threads, allocates 1 MB of memory in each, and then pauses. How much memory is it using?

Let's find out by running it:

$ gcc -pthread threads-memory.c -o threads-memory

@j1elo
j1elo / findValues.js
Last active October 10, 2022 15:37
Prints the path to all values whose names match the given regular expression.
/**
* Prints the path to all values whose names match the given regular expression.
*
* @param {Object} input - An object that contains the parent from where to
* start searching recursively for all key names.
*
* The input object can be passed with just an standalone value, which then
* will be used itself as the prefix for the result.
*
* For example, for a parent object `root` which contains a hierarchy of
// Replacer function meant for `JSON.stringify()`.
function getCircularReplacer() {
const seen = new WeakSet();
return (_key, value) => {
// Non-null "object" properties: return a deep copy without circular references.
if (typeof value === "object" && value !== null) {
// Remove circular references.
if (seen.has(value)) {
// Option 1: Replace circular references with a string.
return "(circular)";