Skip to content

Instantly share code, notes, and snippets.

@colrichie
colrichie / linelim.awk
Last active December 4, 2023 06:30
Rate Limitter for Line Oriented Data
#!/usr/bin/awk -f
######################################################################
#
# linelim.awk : Rate Limitter for Line Oriented Data
#
# If many lines come over the rate limit specified by this command's
# arguments, the latter lines will be disposed of, and the situation
# will continue until the current speed falls below the limit.
#
@colrichie
colrichie / CESU8toUTF8.c
Created November 21, 2023 10:07
Simple Textdata Converter from CESU-8 to UTF-8
/*####################################################################
#
# CESU8toUTF8.c - Simple Textdata Converter from CESU-8 to UTF-8
#
# Usage : cat your_textfile.txt | ./CESU8toUTF8 > converted_text.txt
#
# How to compile me : cc -O3 -o CESU8toUTF8 CESU8toUTF8.c
#
#
# Written by Colonel Richie (@colrichie) on 2023-11-21
@colrichie
colrichie / ahocalc.sh
Created October 11, 2023 09:14
Nabeatsu's Aho Rate Calculator (24 threads shell script)
#!/bin/sh
: > results.txt
seq -f '%.0f' 1 178956971 | awk 'BEGIN{n=0;a=0;}; /3/{a++;next;}; $1%3==0{a++;next;}; {n++;}; END{print "01",a,n;}' >> results.txt &
seq -f '%.0f' 178956972 357913943 | awk 'BEGIN{n=0;a=0;}; /3/{a++;next;}; $1%3==0{a++;next;}; {n++;}; END{print "02",a,n;}' >> results.txt &
seq -f '%.0f' 357913944 536870916 | awk 'BEGIN{n=0;a=0;}; /3/{a++;next;}; $1%3==0{a++;next;}; {n++;}; END{print "03",a,n;}' >> results.txt &
seq -f '%.0f' 536870917 715827890 | awk 'BEGIN{n=0;a=0;}; /3/{a++;next;}; $1%3==0{a++;next;}; {n++;}; END{print "04",a,n;}' >> results.txt &
seq -f '%.0f' 715827891 894784865 | awk 'BEGIN{n=0;a=0;}; /3/{a++;next;}; $1%3==0{a++;next;}; {n++;}; END{print "05",a,n;}' >> results.txt &
seq -f '%.0f' 894784866 1073741841 | awk 'BEGIN{n=0;a=0;}; /3/{a++;next;}; $1%3==0{a++;next;}; {n++;}; END{print "06",a,n;}' >> results.txt &
seq -f '%.0f' 1073741842 1252698818 | awk 'BEGIN{n=0;a=0;}; /3/{a++;next;}; $1%3==0{a++;next;}; {n++;}; END{print "07",a,n;}' >> res
@colrichie
colrichie / mqttjs_tester.html
Last active March 3, 2023 13:58
MQTT over WebSocket Client
<!DOCTYPE html>
<html>
<head>
<!-- Written by colrichie (@col_richie) on 2023-03-03
The original source code is on the following page.
https://hikoleaf.hatenablog.jp/entry/2019/05/18/165038 -->
<title>MQTT.js Test</title>
<script src="https://unpkg.com/mqtt/dist/mqtt.min.js"></script>
</head>
<body>
@colrichie
colrichie / desktoplinker.sh
Created August 8, 2022 10:57
Make a Symbolic Link to the Desktop for the WSL
#!/bin/sh
######################################################################
#
# DESKTOPLINKER.SH: Make a Symbolic Link to the Desktop for the WSL
#
# Written by [email protected] on 2022-08-08
#
######################################################################
@colrichie
colrichie / addpath.sh
Last active August 9, 2022 05:24
Suggest and Add One or More Paths Into Your Run-Script of Shell
#!/bin/sh
######################################################################
#
# ADDPATH.SH: Indicator of How to Add New Paths Into the Proper Run-Script
#
# Written by [email protected] on 2022-08-09
#
######################################################################
@colrichie
colrichie / mkcgipost
Last active August 29, 2015 14:01
MKCGIPOST - HTTP POST String Generator
#! /bin/sh
######################################################################
#
# MKCGIPOST - HTTP POST String Generator
#
# USAGE: mkcgipost <file>
#
# * <file> format :
# <variable_name#1> <value#1>
@colrichie
colrichie / getsunrise.sh
Last active April 25, 2020 15:08
郵便番号に基づき、WebAPI叩いて、日の出・日の入時刻を返すコマンド
#! /bin/sh
#######################################################################
#
# 日の出・日の入時刻検索コマンド GETSUNRISE.SH
#
# [概要]
# ・第1引数に郵便番号(必須,7桁)、第2引数に日付(任意,8桁)を与えると
# WebAPIを叩きに行って、その地域、その日の日の出&日の入り時刻を返すよ。
#
@colrichie
colrichie / sessionf
Last active August 29, 2015 13:56
SESSIONF - Session File Manager (useful for CGI scripts)
#! /bin/sh
######################################################################
#
# SESSIONF - Session File Manager (useful for CGI scripts)
#
# USAGE: sessionf <subcommand> [argument] ...
#
# * List of Subcommands:
# create ..... $0 create at=<template_path>
@colrichie
colrichie / mkcookie
Last active August 29, 2015 13:56
MKCOOKIE - HTTP Cookie String Generator
#! /bin/sh
######################################################################
#
# MKCOOKIE - HTTP Cookie String Generator
#
# USAGE: mkcookie [options] [<name>=<value>]
#
# * <name>=<value> : Cookie varriable name and value
# * OPTIONS: