Skip to content

Instantly share code, notes, and snippets.

package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
@xurwy
xurwy / shttpsc.c
Created April 12, 2022 03:02
Simplest https client with C
// compile : $ gcc file.c -lssl -lcrypto
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/x509v3.h>
#include <string.h>
#include <stdio.h>
#define DEB printf("%d\n",__LINE__ );
SSL *get_ssl(BIO *bio) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title> WebSockets </title>
<script>
try {
var sock = new WebSocket("ws://{{.}}/sock");
//sock.binaryType = 'blob'; // can set it to 'blob' or 'arraybuffer
@xurwy
xurwy / encoded-complexity.go
Created September 20, 2022 00:46
A simplified (not executable) Go websocket ActiveClients map value that prove a point about encoded-complexity.
// Make a map containing clients
ActiveClients = make(map[ClientConn]int)
type ClientConn struct {
websocket *websocket.Conn
clientIP string
}
client := ws.Request().RemoteAddr
import copy
def convert_for_transform(op1, op2):
new_op_1 = {}
new_op_2 = {}
for j in op1:
for i in j:
if i == "retain":
op1_index = j[i]
new_op_1['index'] = op1_index
@xurwy
xurwy / shoot.sh
Created July 31, 2024 03:25
Ffmpeg capture screen with weebcam overlay and audio
ffmpeg -f x11grab -thread_queue_size 64 -video_size 1920x1080 -framerate 30 -i :0 \
-f v4l2 -thread_queue_size 64 -video_size 320x180 -framerate 30 -i /dev/video0 \
-f alsa -i default \
-filter_complex '[0:v][1:v]overlay=main_w-overlay_w:main_h-overlay_h:format=yuv444' \
-vcodec libx264 -preset ultrafast -qp 0 -pix_fmt yuv444p \
-c:a aac -b:a 192k \
video.mkv