Skip to content

Instantly share code, notes, and snippets.

View CypherpunkSamurai's full-sized avatar
😶
Currently Busy 🌻🐢

Cypherpunk Samurai CypherpunkSamurai

😶
Currently Busy 🌻🐢
View GitHub Profile
@CypherpunkSamurai
CypherpunkSamurai / ffmpeg go.md
Created November 18, 2024 05:17
Ffmpeg stream to webrtc

Here's the code:

main.go

package main

import (
	"context"
	"encoding/base64"
@CypherpunkSamurai
CypherpunkSamurai / image.RGBA to H264 using FFmpeg Go-Astiav.go
Created November 17, 2024 03:57
Convert image.RGBA to a H264 mp4 file using FFmpeg Go-Astiav
/*
*
Go-astiav Image to H264 Encoder
This is a simple example of how to convert an image to H264 video using go-astiav.
*/
package main
import (
"errors"
"fmt"
@CypherpunkSamurai
CypherpunkSamurai / compare structs.go
Created November 6, 2024 09:03
Golang Compare Structs
package main
import (
"fmt"
"reflect"
)
type Person struct {
Name string
Age int
@CypherpunkSamurai
CypherpunkSamurai / ffmpeg_windows_build_patch.patch
Last active November 1, 2024 10:07
FFmpeg Build Patch for Windows
# usage: cd ffmpeg && patch -p1 --verbose < ../diff_reverse.patch
#
# created using:
#
# using normal diff (generate a patch from b, for a)
# $ diff -Naru a b > diff.patch
# $ cd ffmpeg && patch -p1 --dry-run --verbose < ../diff.patch
#
# using reverse patching (when you want to reverse a patch)
# a is patched. b is original source 7.0
@CypherpunkSamurai
CypherpunkSamurai / build.ps1
Last active October 31, 2024 09:46
Msys2 Portable Build FFMPEG and go-astiav
# Build ffmpeg and go-astiav using msys2 on windows
# code was created from workflow file (https://github.com/asticode/go-astiav/blob/bc148523bc707cb628df76f2811c579d8b69ce9b/.github/workflows/test.yml)
# and patch (https://github.com/asticode/go-astiav/blob/bc148523bc707cb628df76f2811c579d8b69ce9b/.github/workflows/windows.patch)
# and makefile (https://github.com/asticode/go-astiav/blob/bc148523bc707cb628df76f2811c579d8b69ce9b/Makefile)
# Variables
$InstallPath = "$PWD\compile"
$Msys2Path = "$InstallPath\msys64"
@CypherpunkSamurai
CypherpunkSamurai / windows.sh
Created October 30, 2024 13:32 — forked from fasterthanlime/windows.sh
Building ffmpeg & libx264 with MSVC from msys2
#!/bin/bash
set -e
if [[ -z "${FFRUST_VC_PATH}" ]]; then
if [[ -n "${FFRUST_RECURSING}" ]]; then
echo "Something went terribly wrong with our MVSC/msys2 magic"
exit 1
fi
1. Install MSYS2 from https://msys2.github.io/
2. Install Mingw-W64 `pacman -S mingw-w64-i686-gcc`
3. Install git autoconf automake libtool make pkg-config
`pacman -S git`
`pacman -S autoconf`
`pacman -S automake`
`pacman -S libtool`
`pacman -S make`
`pacman -S pkg-config`
4. yasm:http://yasm.tortall.net/,change to yasm.exe,move to C:\msys32\usr\bin
@CypherpunkSamurai
CypherpunkSamurai / README.md
Created October 12, 2024 04:24 — forked from jamiephan/README.md
A script to automatically add ALL items to your account in quixel

Script to add all items from quixel

As quixel is being removed, all items are free to aquire. This script is to automate the process to add items to your account (As of writing, a total of 18874 items)

Note: This script only tested in the latest version of Chrome.

How to use

  1. Copy the script from below (run.js)
  2. Login into https://quixel.com
@CypherpunkSamurai
CypherpunkSamurai / main.go
Created October 8, 2024 11:51
Sub Classing in Go
func useGamepad(gamepad VigemGamepad) {
gamepad.Connect()
gamepad.UpdateState()
// Use other methods as needed
gamepad.Disconnect()
}
// Usage
x360 := &X360Gamepad{BaseGamepad: BaseGamepad{Model: "X360", ModelID: 1}}
ds4 := &DS4Gamepad{BaseGamepad: BaseGamepad{Model: "DS4", ModelID: 2}}
@CypherpunkSamurai
CypherpunkSamurai / subclassing.go
Created October 8, 2024 10:39
Sub Classing in Go
package main
import "fmt"
// Animal interface
type Animal interface {
Speak() string
}
// Bird struct