Skip to content

Instantly share code, notes, and snippets.

@bongole
bongole / live-tester.sh
Created December 12, 2022 16:15
YouTubeにテスト動画を流すスクリプト
#!/usr/bin/env bash
RTMP_URL="rtmp://a.rtmp.youtube.com/live2/<STREAM-KEY>"
ffmpeg \
-re \
-f lavfi -i "testsrc=s=1920x1080:r=30,format=yuv420p" \
-f lavfi -i "sine=f=440:b=4" \
-vf "drawtext=text='%{pts\:localtime\:$(date +%s)\:%Y-%m-%d %T}':fontsize=48:fontcolor=white:box=1:boxborderw=6:boxcolor=black@0.75:x=(w-text_w)/2:y=h-text_h-20" \
-vcodec libx264 -pix_fmt yuv420p -preset medium -r 30 -b:v 1M \
@bongole
bongole / ffmpeg-pipe.js
Last active October 14, 2020 16:33
extract raw I420 frame from ffmpeg with node.js
const tmp = require('tmp')
tmp.setGracefulCleanup()
const spawn = require('child_process').spawn
const net = require('net')
async function sleep(t){
return new Promise((res) => setTimeout(res, t))
}
(async function(){
@bongole
bongole / Dockerfile
Created July 15, 2020 07:50
sslsplit for raspi4
FROM arm64v8/ubuntu:20.04 as builder
RUN apt-get update \
&& apt-get install -y pkg-config openssl libz-dev libssl-dev libevent-dev libpcap-dev libnet1-dev \
libc-dev linux-headers-5.4.0-1013-raspi gcc make git-core --no-install-recommends
COPY . /opt/sslsplit
WORKDIR /opt/sslsplit
ENV TCPPFLAGS -DDOCKER
RUN export SOURCE_DATE_EPOCH=$(stat -c '%Y' *.c *.h|sort -r|head -1); \
make clean && make -j$(nproc) all
@bongole
bongole / Dockerfile
Created July 13, 2020 06:57
static ffmpeg
FROM alpine:3.12.0 AS builder
# bump: ffmpeg /FFMPEG_VERSION=([\d.]+)/ https://github.com/FFmpeg/FFmpeg.git|^4
ARG FFMPEG_VERSION=4.3
ARG FFMPEG_URL="https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
ARG FFMPEG_SHA256=a7e87112fc49ad5b59e26726e3a7cae0ffae511cba5376c579ba3cb04483d6e2
# bump: mp3lame /MP3LAME_VERSION=([\d.]+)/ svn:http://svn.code.sf.net/p/lame/svn|/^RELEASE__(.*)$/|/_/./|*
ARG MP3LAME_VERSION=3.100
ARG MP3LAME_URL="https://sourceforge.net/projects/lame/files/lame/$MP3LAME_VERSION/lame-$MP3LAME_VERSION.tar.gz/download"
ARG MP3LAME_SHA256=ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e
@bongole
bongole / Dockerfile
Last active February 9, 2021 09:32
blender + gpu in docker
# docker run --gpus=all --rm -it -p 3389:3389 --shm-size=256m -u ubuntu --privileged myblender
FROM ubuntu:20.04 as builder
ENV DEBIAN_FRONTEND noninteractive
RUN sed -i.bak -e "s%http://archive.ubuntu.com/ubuntu/%http://ftp.iij.ad.jp/pub/linux/ubuntu/archive/%g" /etc/apt/sources.list
RUN sed -i "s/# deb-src/deb-src/g" /etc/apt/sources.list
RUN apt-get -y update \
&& apt-get -yy upgrade \
&& apt-get -yy install git libpulse-dev autoconf m4 intltool build-essential dpkg-dev
@bongole
bongole / Dockerfile
Last active October 1, 2020 16:55
my janus dockerfile
FROM ubuntu:20.04 AS build-env
ENV DEBIAN_FRONTEND=noninteractive
RUN sed -i.bak -e "s%http://archive.ubuntu.com/ubuntu/%http://ftp.iij.ad.jp/pub/linux/ubuntu/archive/%g" /etc/apt/sources.list
RUN apt-get update \
&& apt-get install -y --no-install-recommends wget curl ca-certificates build-essential checkinstall git \
python3-pip \
libmicrohttpd-dev libjansson-dev \
libssl-dev libsofia-sip-ua-dev libglib2.0-dev \
libopus-dev libogg-dev libcurl4-openssl-dev \
@bongole
bongole / test.py
Last active April 13, 2020 10:00
altair + japan geojson
import altair as alt
import pandas as pd
import random
import requests
#geo_json = requests.get('https://github.com/dataofjapan/land/raw/master/japan.topojson').json()
#japan_geo = alt.Data(
# values=geo_json,
# format=alt.TopoDataFormat(feature='japan',type='topojson')
#)
@bongole
bongole / test.rb
Created September 20, 2017 10:21
test http tcp packets
require 'ethon'
require 'httpclient'
require 'net/http'
require 'uri'
url = 'http://example.com/'
dummy = 'a' * 2000
# ethon
easy = Ethon::Easy.new
@bongole
bongole / fiddle_ffi.rb
Last active September 20, 2017 06:29
require 'ffi'
require 'fiddle'
require 'benchmark'
def setup
open("/tmp/test.c","w") do |io|
c_src = <<-EOS
int add(int a, int b){
return a + b;
}
@bongole
bongole / date_parse.rs
Created February 16, 2017 10:16
nomで日付のパーステスト
#[macro_use]
extern crate nom;
use nom::*;
fn take_digits_n(input: &[u8], n: u8) -> IResult<&[u8],&[u8]> {
verify!(input, take!(n), |chars: &[u8]| chars.iter().all(|c: &u8| is_digit(*c)) )
}
named!(take_4_digits, apply!(take_digits_n, 4));
named!(take_1_or_2_digits, alt_complete!( apply!(take_digits_n, 2) | apply!(take_digits_n, 1)) );