Skip to content

Instantly share code, notes, and snippets.

@aachyee
aachyee / VMWarePlayerLauncher.bat
Last active March 21, 2021 10:38
VMWare Player Launcher Bat for Windows
@echo off
rem Usage: VMWarePlayerLauncher.bat [Path to .vmx files]
setlocal enabledelayedexpansion
set "errorlevel="
for %%a in (%*) do (
if "%%~xa"==".vmx" (
if exist "%%~a" (
set "result="
for /f "tokens=*" %%i in ('FINDSTR /C:"workingDir = " "%%~a"') do set "result=%%i"
rem for /f "tokens=2 delims==" %%i in ("!result!") do set "result=%%i"
@aachyee
aachyee / gist:f42c765bcbeade506107457a11c685b3
Last active August 30, 2023 15:57 — forked from StephenGenusa/gist:90f0ecc094eb630975a97732489d4ba4
Build wget2 with all features on clean Ubuntu 20.04 installation
sudo apt-get -y install gcc g++ make cmake doxygen pandoc awk sed perl python3 python-is-python3 m4 bison flex lzip lcov git zlib1g-dev libssl-dev libnghttp2-dev autoconf autoconf-archive autogen automake autopoint libtool pkg-config texinfo nettle-dev libunistring-dev gettext make libbz2-dev libbrotli-dev libzstd-dev liblz-dev libpcre2-dev libmicrohttpd-dev libgpgme-dev liblzma-dev libgnutls28-dev libgcrypt20-dev git-merge-changelog libidn2-0 libpsl-dev # libpcre3-dev nettle-bin lzma brotli zstd lzip
cd ~/Downloads
mkdir wget-dev
cd wget-dev
git clone https://gitlab.com/rockdaboot/libhsts
cd libhsts
autoreconf -fi
./configure
make
@aachyee
aachyee / XMLHttpRequest_Logger.js
Last active December 3, 2021 13:14
XMLHttpRequest Logger
// XMLHttpRequest Logger
function headPadding(s,l,p=' '){
let t=Array(l+1).join(p)+s.toString();
return l>=1?t.slice(-l):'';
}
function tailPadding(s,l,p=' '){
let t=s.toString()+Array(l+1).join(p);
return l>=1?t.slice(0,l):'';
}
@aachyee
aachyee / udp.rb
Last active September 6, 2021 23:41 — forked from akostadinov/udp.rb
Ruby UDP echo server and client
require 'socket'
# echo server
Socket.udp_server_loop(4444) do |data, src|
src.reply data
end
# client
addr = Socket.sockaddr_in(4444, "localhost")
socket = Socket.new(:INET, :DGRAM)
begin
@aachyee
aachyee / auto-ovpn.sh
Created October 1, 2021 13:57 — forked from lowstz/auto-ovpn.sh
Linux openvpn auto reconnect script
#!/bin/bash
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
### Thanks Xream's Work XD
# if you don't have several vpn servers to select, you can comment following line
# and use your openvpn config file name to replace "${host}.ovpn" in while loop.
read -p "Select the host: " host
@aachyee
aachyee / XMLHttpRequest_API_hook_sample.js
Last active December 5, 2021 15:57
XMLHttpRequest API hook Sample
// XMLHttpRequest API hook Sample
function headPadding(s,l,p=' '){
let t=Array(l+1).join(p)+s.toString();
return l>=1?t.slice(-l):'';
}
function tailPadding(s,l,p=' '){
let t=s.toString()+Array(l+1).join(p);
return l>=1?t.slice(0,l):'';
@aachyee
aachyee / ipv4_tools.sh
Last active December 3, 2021 18:31
IPv4 calculation tool for bash
# IPv4 calculation tool for bash
# Usage: . thisfile
# referrences
# ネットワーク計算ツール・CIDR計算ツール | Softel labs https://www.softel.co.jp/labs/tools/network/
# CIDRとは | DevelopersIO https://dev.classmethod.jp/articles/what-is-cidr/
# convert binary number to decimal number
# bin2dec 1100 # => 12
bin2dec(){
[[ $1 ]] || return
local b
@aachyee
aachyee / EBIあり
Created January 12, 2022 01:19 — forked from mmasaki/EBIあり
緊急地震速報の電文サンプル
37 03 00 110415233453 C11
110415233416
ND20110415233435 NCN005 JD////////////// JN///
251 N370 E1408 010 66 6+ RK66324 RT01/// RC13///
EBI 251 S6+6- ////// 11 300 S5+5- ////// 11 250 S5+5- ////// 11
310 S0404 ////// 11 311 S0404 ////// 11 252 S0404 ////// 11
301 S0404 ////// 11 221 S0404 ////// 01 340 S0404 ////// 01
341 S0404 ////// 01 321 S0404 233455 00 331 S0404 233457 10
350 S0404 233501 00 360 S0404 233508 00 243 S0403 ////// 01
330 S0403 233454 00 222 S0403 233455 00
@aachyee
aachyee / cutmov.sh
Last active January 20, 2023 15:49
Bash example script with getopt (cut out the movie file from any position to any position by ffmpeg)
#!/usr/bin/env bash
# SUMMARY
# cut out the movie file from any position to any position by ffmpeg.
#
# USAGE
# sh cutmov.sh --help
#
# LICENSE
# MIT
#
@aachyee
aachyee / eval_worker.ts
Last active March 6, 2023 12:41
General eval worker with timeout in deno.
// eval_worker.ts
// General eval worker with timeout in deno.
/// <reference lib="deno.worker" />
/*
Usage:
import {waitForEvalWorkerResponse} from "./eval_worker.ts"
// await waitForEvalWorkerResponse ( 'javascript code...', 3000 )
try {
const source1 = 'await fetch("https://api.github.com/users/octocat").then((response)=>{return response.json()}).catch(err=>{return err})';
const result1 = await waitForEvalWorkerResponse(source1, 3000);