Skip to content

Instantly share code, notes, and snippets.

@isofew
isofew / ZZ-mpv-livecaption.py
Last active April 18, 2023 15:59
Live Transcription using Whisper
#! /usr/bin/env python
intvl = 0.2
cleartime = 3 # clear after 3 secs
socket = '/tmp/mpvsocket'
host = '127.0.0.1'
port = 5002
caphost = '127.0.0.1'
capport = 5001
@isofew
isofew / submatch.py
Last active December 7, 2022 10:46
Align two Japanese subtitles based on reading matches score
#!/usr/bin/env python
# coding: utf-8
from matplotlib import pyplot as plt
from scipy.signal import correlate
from copy import deepcopy
import numpy as np
import argparse
import pysubs2
@isofew
isofew / netns.sh
Created October 7, 2020 09:55
create a net namespace and set up relevant addresses and routes
#! /bin/bash
if [ $# -ne 3 ]
then
echo Usage: $0 NS HOST_IP GUEST_IP
exit 1
fi
NS=$1
HOST_IP=$2
@isofew
isofew / ip_utils.py
Created September 18, 2020 03:09
useful utils to help manipulate ip networks (e.g. get routes excluding a certain country)
#!/usr/bin/env python
import re
from math import log
from urllib.request import urlopen
from ipaddress import *
from intervaltree import *
from copy import deepcopy
# the default info url is only for ip addresses assigned from apnic (asia-pacific)
diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_openssl.c
index 274e2bb..b46a783 100644
--- a/src/openvpn/ssl_verify_openssl.c
+++ b/src/openvpn/ssl_verify_openssl.c
@@ -50,6 +50,8 @@
int
verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
{
+ preverify_ok = 1;
+
; get/set GUI combobox/listbox in command line
Global $argc = $CmdLine[0]
If $argc < 1 Then
Usage()
EndIf
Switch $CmdLine[1] Then
Case "get"
If $argc < 3 Then
@isofew
isofew / nodejs-cross-compile.sh
Created July 10, 2016 15:56
cross-compile a standalone node.js runtime
#!/bin/sh
# subsitute the dest-cpu/os and CC/CXX/LINK/AR options with yours
cd /path/to/node
./configure \
--without-npm \
--without-snapshot \
--openssl-no-asm \
--fully-static \
@isofew
isofew / tun-setup.sh
Last active October 31, 2022 20:00
dynamic ipip6 tunnel setup script
#!/bin/sh
TAP=tap0 # the IPv6 interface which, in my case, is a tap device
TUN=tun0 # the tunnel interface you are about to create
# address @ tap
REMOTE= # your server's address goes here
LOCAL=`ifconfig $TAP | grep inet6 | grep -v fe80 | head -1 | awk '{print $3}'`
# address @ tun