This file contains 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 | |
main() | |
{ | |
echo "PID: $$" | |
for s in SIGHUP SIGINT SIGQUIT SIGTERM EXIT; do | |
if [ SIGTERM = $s ]; then | |
trap "echo '$s is caught'; exit" $s | |
else | |
trap "echo '$s is caught'" $s | |
fi |
This file contains 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 | |
main() | |
{ | |
local opt_a= | |
local opt_b= | |
local opt_c= | |
local args= | |
getargs "$@" | |
if [ -n "$opt_a" ]; then echo "opt_a [$opt_a]"; fi |
This file contains 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/env python3 | |
# vim: fileencoding=utf-8 | |
import argparse, jmespath, json, sys | |
def get_args(): | |
parser = argparse.ArgumentParser(description='JMESPath Evaluator') | |
parser.add_argument('-i', '--indent', type=int, help='indent') | |
parser.add_argument( | |
'--ensure-ascii' |
This file contains 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/env python3 | |
# vim: fileencoding=utf-8 ff=unix | |
from datetime import datetime | |
from zoneinfo import ZoneInfo | |
import argparse, os, time | |
def get_args(): | |
parser = argparse.ArgumentParser( | |
description='Local/Remote Time Converter' |
This file contains 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/env python3 | |
# vim: fileencoding=utf-8 ff=unix | |
import argparse, json, requests, sys | |
def message( | |
webhook, msg | |
, links=None, facts=None, subtitle=None, title=None, themecolor=None | |
): | |
payload = { |
This file contains 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/env python3 | |
# vim: fileencoding=utf-8 ff=unix | |
from math import log | |
from random import randint | |
import argparse | |
import logging | |
import os | |
import re | |
import sys |
This file contains 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 | |
# Reference Source | |
# https://www.nist.gov/pml/time-and-frequency-division/popular-links/daylight-saving-time-dst | |
function is_dst() | |
{ | |
epoch_secs=$(date --date="$1" +%s) | |
src_yr=$(date --date="$1" +%Y) | |
mar1wday=$(date --date="$src_yr-03-01" +%w) |
This file contains 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/env python3 | |
# vim: fileencoding=utf-8 ff=unix hls lcs=tab\:>. list noet sw=4 ts=4 tw=76 | |
# | |
# How to use: | |
# | |
# Scenario 1 - show only the first 16 entries | |
# $ lcsv.py --limit 16 my_data.csv | |
# | |
# Scenario 2 - convert CSV which uses pipe characters "|" back to commas | |
# $ lcsv.py --output-delimiter=, --delimiter='|' my_data.csv |
This file contains 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/env python3 | |
# vim: fileencoding=utf-8 ff=unix lcs=tab\:>. list noet sw=4 ts=4 tw=0 | |
# | |
# How to use: | |
# $ unescape.py 'Line 1\nLine 2\nLine 3\n' 'いち\nに\nさん\n' | |
# | |
import sys | |
def unescape(s): | |
return s.encode('raw_unicode_escape').decode('unicode_escape') |
This file contains 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
/* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2021 Chun-Kwong Wong | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to | |
* deal in the Software without restriction, including without limitation the | |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
* sell copies of the Software, and to permit persons to whom the Software is |
NewerOlder