Skip to content

Instantly share code, notes, and snippets.

@u-r-w
u-r-w / 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
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
@u-r-w
u-r-w / 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
<!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
@u-r-w
u-r-w / 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) {
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
// unmark pthread_detach(), memory leak will be gone
void* process( void* data ) {
printf( "hello world\n" );
}
main() {
package main
import (
"fmt"
"encoding/json"
)
var b = []byte(`{
"Module": [
{
@u-r-w
u-r-w / update-golang.md
Created July 12, 2021 05:03 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
int ipAddress = wifiInfo.getIpAddress();
String ipString = String.format("%d.%d.%d.%d", (ip & 0xff), (ip >> 8 & 0xff), (ip >> 16 & 0xff), (ip >> 24 & 0xff));