Skip to content

Instantly share code, notes, and snippets.

@tai
tai / lc
Created April 30, 2021 13:37
#!/usr/bin/perl
sub usage {
my $p = ($0 =~ m|[^/]+$|, $&);
print STDERR <<EOF;
$p - Add linecolor to input
Usage: $p <perlexpr> [color] [<perlexpr> <color> ...]
Example:
\$ lsusb -tv | $p '!/hub/io'
\$ lsusb -tv | $p '!/hub/io' green
@tai
tai / ve
Created April 28, 2021 03:26
#!/bin/sh
usage() {
local p=${0##*/}
cat <<EOF 1>&2
$p - Run command in alternative environment
Usage: [VE_BACKEND=(proot|bwrap|unshare|chroot)] $p <env> cmd args...
Example:
$ eval \$(ve completion)
$ $p /n/hc xeyes
#!/usr/bin/env -S powershell.exe -File
#
# sudo in PowerShell
#
function progname {
return (Get-ChildItem $MyInvocation.ScriptName).BaseName
}
function usage {
#!/bin/sh
set -e
usage() {
local p=${0##*/}
cat <<EOF 1>&2
$p - Read or write 32bit Volume ID of exFAT filesystem
Usage: $p <dev> [AABBCCDD]
Example:
@tai
tai / lc
Created November 28, 2020 04:26
#!/usr/bin/perl
sub usage {
my $p = ($0 =~ m|[^/]+$|, $&);
print STDERR <<EOF;
$p - Add linecolor to input
Usage: $p <perlexpr> [color] [<perlexpr> <color> ...]
Example:
\$ lsusb -tv | $p '!/hub/io'
\$ lsusb -tv | $p '!/hub/io' 'green'
@tai
tai / identrust-dst-root-ca-x3.cer
Created November 22, 2020 03:44
IdenTrust DST Root CA X3
-----BEGIN CERTIFICATE-----
MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw
"""
Tag Rewrite
"""
import numpy as np
from gnuradio import gr
import pmt
log = gr.logger("TR")
log.set_level("DEBUG")
@tai
tai / main.c
Created July 23, 2020 16:24
USB-Serial bridge on PSoC5LP dongle
#include <stdio.h>
#include "project.h"
#define IMO_CLOCK 24000000u
#define UART_BASE_CLOCK IMO_CLOCK
#define SPI_BASE_CLOCK IMO_CLOCK
#define I2C_BASE_CLOCK IMO_CLOCK
#define USBUART_BUFFER_SIZE 64u
#!/usr/bin/env run-cargo-script
//
// Repeat same character
//
fn main() {
println!("0: {}", (0..40).map(|_| "-").collect::<Vec<_>>().join(""));
println!("1: {}", (0..40).map(|_| "-").collect::<String>());
@tai
tai / casio.py
Created September 21, 2019 15:28
#!/usr/bin/env python3
# -*- coding: utf-8-unix -*-
"""
Label printing tool for Casio "NameLand" USB label printer.
This module provides control interface to series of label printers
from Casio, namely KLD-300. It probably works with other old-ish
models, but I have only tested this with KLD-300.
KLD-300 is an USB device with vendor-specific class, and uses