This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| # fetch fund quotes from yahoo finance japan | |
| use utf8; | |
| use strict; | |
| use warnings; | |
| use XML::LibXML; | |
| use Finance::Quote; | |
| # extract fund symbols from gnucash xml file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| # extract pricedb from gzipped gnucash xml file | |
| use utf8; | |
| use strict; | |
| use warnings; | |
| use XML::LibXML; | |
| die 'specify gnucash xml file as argument' unless $ARGV[0]; | |
| my $doc = XML::LibXML->load_xml(location => $ARGV[0]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
| <!-- convert KeePass XML (2.x) format to 7-column keeper.txt format --> | |
| <xsl:output method="text" encoding="utf-8" /> | |
| <xsl:template match="/"> | |
| <xsl:apply-templates select="/KeePassFile/Root/Group" /> | |
| </xsl:template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ghc -W -O -threaded --make runfor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| # convert docomo vcard format to ldif | |
| use utf8; | |
| use strict; | |
| use warnings; | |
| use Unicode::Normalize; | |
| binmode(STDOUT, ':utf8'); | |
| die 'error: no vcard file specified (*.vcf)' if (@ARGV < 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -x | |
| # Install Perl modules in macOS system Perl without cluttering /usr/local | |
| # Prerequisite | |
| xcode-select --install | |
| # Install modules locally | |
| sysperl=/usr/bin/perl | |
| FQ_LOAD_QUOTELET=-defaults curl -L https://cpanmin.us/ | \ | |
| $sysperl - -n --local-lib=~/.sys_perl5 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gncxml | |
| def join_transfer(sp): | |
| pairs = sp.reset_index() \ | |
| .groupby(["trn_idtype", "trn_id"]) \ | |
| .filter(lambda x: len(x) == 2) | |
| dup = pairs[["trn_idtype", "trn_id", "idtype", "id"]] \ | |
| .join(pairs.set_index(["trn_idtype", "trn_id"]) \ | |
| .add_prefix("transfer_"), \ | |
| on=["trn_idtype", "trn_id"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from datetime import datetime | |
| from secrets import randbits | |
| from typing import Tuple | |
| # In general, the layered approach demonstrates much better collision resistance than | |
| # the naive approach when the per-second randomness field is sufficiently large to | |
| # accommodate a possible number of concurrent generators. Otherwise, the layered | |
| # approach tends to cause burst collisions when the per-second randomness collides. | |
| LEN_PER_SEC = 16 | |
| LEN_PER_GEN = 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * uuidv7.c - Experimental stateless UUIDv7 implementation as of RFC draft 02 | |
| * | |
| * Required: `clock_gettime()`, `arc4random_buf()`, and ~15-microseconds or | |
| * finer system clock resolution. | |
| * | |
| * This implementation employs 52-bit timestamp (consisting of 36-bit whole | |
| * seconds and 16-bit sub-second fraction) and 70-bit cryptographically strong | |
| * random integer in the following layout. It does not guarantee the monotonic | |
| * order of the generated IDs within the same timestamp (i.e. within ~15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const DIGITS = "0123456789abcdefghijklmnopqrstuv"; | |
| /** O(1) map from ASCII code points to digit values. */ | |
| const DECODE_MAP = new Uint8Array(128).fill(0xff); | |
| for (let i = 0, uc = DIGITS.toUpperCase(); i < DIGITS.length; i++) { | |
| DECODE_MAP[DIGITS.charCodeAt(i)] = i; | |
| DECODE_MAP[uc.charCodeAt(i)] = i; // omit this to make decoder case-sensitive | |
| } | |
| /** Encodes a byte array to text. */ |
OlderNewer