Difference between revisions of "Computing"
Line 307: | Line 307: | ||
Take examples, like 20190822005901.9Z, 20190801230059.09Z, 20190822005901.991Z, and play around in [https://regex101.com/ Regex101] online tool | Take examples, like 20190822005901.9Z, 20190801230059.09Z, 20190822005901.991Z, and play around in [https://regex101.com/ Regex101] online tool | ||
=== ISO 8601 Date and Time format === | |||
Date and time with UTC | |||
<code>^2(\d\d\d)([0][1-9]|[1][0-2])([0][1-9]|[1-2][\d]|[3][0-1])T(([0-1][\d]|[2][0-3])([0-5][\d])([0-5][\d])|240000)Z?$</code> | |||
This matches: | |||
* 20231106T240000Z | |||
== Miscellaneous Stuff == | == Miscellaneous Stuff == |
Latest revision as of 23:04, 5 November 2023
My Computing Area
Personal Computer
Personal Computer section
Web based utiliites
Networking
Networking section
Video Games
Programming & Scripting
TIOBE Programming Community Index
ASN.1
PHP
C++
C Sharp
Multi-threaded TCP server in C#
Eclipse
My Eclipse pages
Eclipse IDE tools
Eclipse tutorials
Python
Lua
Lua is a powerful, fast, lightweight, embeddable scripting language.
shell scripting
PERL
Java
JavaWorld is an ad covered site that offers how-to articles, news stories, and other information on Java development.
developer.com is a source for Java information
Java guru has articles and training material
JavaScript
APIs
apilayer Automate What Should Be Automated. Unparalleled suite of productivity-boosting Web APIs & cloud-based SaaS Applications for developers and companies of any size.
REST Countries Get information about countries via a RESTful API
OpenAPI
Version control systems
Pijul
Pijul is a free and open source (GPL2) distributed version control system. Its distinctive feature is to be based on a sound theory of patches, which makes it easy to learn and use, and really distributed.
Git
Database stuff
PostgreSQL
MySQL & MariaDB
My MySQL & MariaDB Notes section (contains some MariaDB stuff)
Regular Expressions
Resources
Regex101 site (very handy online checker and pretty) Regex Library
IPv4 address examples
^(([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.)((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$
Some test formats:
1.0.0.0 < - matches 0.0.0.0 <- no match 1.0.0.255 < - matches 1.01.0.255 < - no match 1.255.255.255 < - matches 1.256.255.255 < - no match 255.255.255.255 < - matches 256.255.255.255 < - no match
IPv4 with slash & network mask
^(([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.)((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\/([1-9]|[1-2]\d|3[0-2])$
Some examples to test:
1.0.0.0/1 < - matches 1.0.0.255/30 < - matches 1.255.255.255/24 < - matches 255.255.255.255/10 < - matches 1.0.0.0/100 < - matches 1.0.0.255/0 < - no match
IPv6 address examples (hexadecimal formats only)
Long form only:
^([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}$
Medium form that allows leading zeros in hextet:
^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$
Medium form that does not allow leading zeros in hextet:
^(([0-9a-fA-F]{1}|[1-9a-fA-F]{1}[0-9a-fA-F]{1,3}):){7}([0-9a-fA-F]{1}|[1-9a-fA-F]{1}[0-9a-fA-F]{1,3})$
Some test formats:
0:0:0:0:0:0:0:0 7:6:5:4:3:2:1:0 ffff:ffff:ffff:ffff:FFFF:FFFF:FFFF:FFFF 0fff:ffff:ffff:ffff:FFFF:FFFF:FFFF:FFFF (invalid due to leading 0 in first hextet group)
IPv6 with slash & network mask
(^(([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4})|(^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}))\/([1-9]|[1-9]\d|1[0-1]\d|12[0-8])$
Some test formats:
0:0:0:0:0:0:0:0/69 < - matches 0:0:0:0:0:0:0:0/1 < - matches 7:6:5:4:3:2:1:0/10 < - matches 7:6:5:4:3:2:1:0/99 < - matches 7:6:5:4:3:2:1:0/128 < - matches 7:6:5:4:3:2:1:0/129 < - no match 7:6:5:4:3:2:1:0/0 < - no match ffff:ffff:ffff:ffff:FFFF:FFFF:FFFF:FFFF/55 < - matches fff:ffff:ffff:ffff:FFFF:FFFF:FFFF:FFFF/119 < - matches 2001:0db8:0000:0000:0000:ff00:0042:8329/0 < - no match 2001:0db8:0000:0000:0000:ff00:0042:8329/20 < - matches 2001:db8:0:0:0:ff00:42:8329/9 < - matches
IPv4 & IPv6 combined regex
I simply combined the above examples into one pattern that can match various formats. The following pattern matches both IPv4 and IPv6 addresses, both long and medium (allow leading zeros), using single regex:
(^(([0-9a-fA-F]{1,4}:){4,7}[0-9a-fA-F]{1,4})$)|(^([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}$)|(^(([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.)((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$)
IPv4 and IPv6 network and masks
(^(([0-9a-fA-F]{1,4}:){4,7}[0-9a-fA-F]{1,4})\/([1-9]|[1-9]\d|1[0-1]\d|12[0-8])$)|(^([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}\/([1-9]|[1-9]\d|1[0-1]\d|12[0-8])$)|(^(([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.)((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\/([1-9]|[1-9]\d|1[0-1]\d|12[0-8])$)
Some examples
0:0:0:0:0:0:0:0/1 < - matches 0:0:0:0:0:0:0:0/1 < - matches 7:6:5:4:3:2:1:0/10 < - matches 7:6:5:4:3:2:1:0/99 < - matches 7:6:5:4:3:2:1:0/128 < - matches 7:6:5:4:3:2:1:0/129 < - no match 7:6:5:4:3:2:1:0/0 < - no match ffff:ffff:ffff:ffff:FFFF:FFFF:FFFF:FFFF/69 < - matches fff:ffff:ffff:ffff:FFFF:FFFF:FFFF:FFFF/119 < - matches 2001:0db8:0000:0000:0000:ff00:0042:8329/0 < - no match 2001:db8:0:0:0:ff00:42:8329/9 < - matches 1.0.0.0/1 < - matches 1.0.0.255/30 < - matches 1.255.255.255/24 < - matches 255.255.255.255/10 < - matches 1.0.0.0/100 < - matches 1.0.0.255/0 < - no match
Ethernet MAC address examples
The following MAC address regex examples match lower or upper case hexadecimal values.
MAC address format using hyphen between each octet (default output for PowerShell)
^([0-9a-fA-F]{2}-){5}[0-9a-fA-F]{2}$ 98-E7-43-D1-74-D4 < - matches
MAC address format using colon (default for Linux)
^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$ 98:E7:43:-D1:74:D4 < - matches
MAC address format without any delimiters
^[0-9a-fA-F]{12}$ 98E743D174D4 < - matches
Combine all three above regex to match any of three
(^([0-9a-fA-F]{2}-){5}[0-9a-fA-F]{2}$)|(^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$)|(^[0-9a-fA-F]{12}$) 98-E7-43-D1-74-D4 < - matches 98:E7:43:D1:74:D4 < - matches 98E743D174D4 < - matches
Note that you must assert start and end characters within the groups above.
If you use ^(([0-9a-fA-F]{2}-){5}[0-9a-fA-F]{2})|(([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})|([0-9a-fA-F]{12})$
(assertions are outside groups) then invalid values would be matched:
98-E7-43-D1-74-D4 98-E7-43-D1-74-D40 < - invalid MAC, but matched regex 98:E7:43:D1:74:D4 98:E7:43:D1:74:D40 < - invalid MAC, but matched regex 98E743D174D4 98E743D174D40 < - invalid MAC, but matched regex
My regex notes for checking an ASN.1 GeneralizedTime type
General (my wording!)
- ^ means start of string
- () means capture everything inside
- | means or, aka "pipe" key
- [] means single character with rules, rules are inside square brackets
- \d means any digit
- {} means quantity with specified conditions
- ? means zero or one of previous character
- $ means end of string
Regex based on US requirements for time (within 200ms of event time) plus optional Z offset:
^20(19|20)([0][1-9]|[1][0-2])([0][1-9]|[1-2][\d]|[3][0-1])([0-1][\d]|[2][0-4])([0-5][\d])([0-5][\d]).\d{1,3}Z?$
Regex explained
^20(19|20)
= string starts with exactly 20 followed by 19 or 20 (match year "YYYY format")([0][1-9]|[1][0-2])
= next two characters must match either [0][1-9] or [1][0-2], which means 01-09 or 10-12 (match month "MM format")([0][1-9]|[1-2][\d]|[3][0-1])
= next two characters must match either [0][1-9] or [1-2][\d] or [3][0-1], which means 01-09 or 10-29 or 30-31(match day "DD format")([0-1][\d]|[2][0-4])
= next two characters must match either [0][\d] or [1][\d] or [2][0-4], which means 00-09 or 10-19 or 20-24 (match hour "HH format" in 24-hour format)([0-5][\d])
= next two characters must match [0-5][\d], which means 00-59 (match minutes "MM format")([0-5][\d])
= next two characters must match [0-5][\d], which means 00-59 (match minutes "SS format").
= next character must be . (period)\d{1,3}
= next 1 to 3 characters must be any digit (match milliseconds .f, .ff, .fff format)Z?
= next character must be zero or one of Z (capital Z). Zero Z means Z is missing$
= end of string (no following characters)
Take examples, like 20190822005901.9Z, 20190801230059.09Z, 20190822005901.991Z, and play around in Regex101 online tool
ISO 8601 Date and Time format
Date and time with UTC
^2(\d\d\d)([0][1-9]|[1][0-2])([0][1-9]|[1-2][\d]|[3][0-1])T(([0-1][\d]|[2][0-3])([0-5][\d])([0-5][\d])|240000)Z?$
This matches:
- 20231106T240000Z
Miscellaneous Stuff
Let's Encrypt
Everyone should encrypt everything, end-to-end!
User Guide renewing certificates
Ansible
Red Hat Ansible is a universal language, unraveling the mystery of how work gets done. Turn tough tasks into repeatable playbooks. Roll out enterprise-wide protocols with the push of a button. Give your team the tools to automate, solve, and share.
Haxe
Haxe is an open source toolkit based on a modern, high level, strictly typed programming language, a cross-compiler, a complete cross-platform standard library and ways to access each platform's native capabilities.
Action Script 3.0
Gosu
Gosu is a programming language for the Java Virtual Machine (JVM).
Storage Solutions
Building a home NAS system on Linux
Gaming Technologies
Graphic Input Devices
Article about Best drawing tablet of 2018
Interesting Hardware Articles
Benefits from larger amounts of RAM
drive slag data destruction method
Operating System stuff
Linux area
Solaris area
Software stuff
My software notes section
Video Voice Fax companies
VoiceAge is the forerunner in the development and dissemination of wideband speech and audio compression technologies in the wireless, internet and multimedia fields.
Digital Rights Management
PallyCon provides cloud-based SaaS multi-DRM solution and Forensic Watermarking service.
general stuff
Dreamhost section
Females in technology resources
Django Girls is a non-profit organization and a community that empowers and helps women to organize free, one-day programming workshops by providing tools, resources and support.
Kansas City Women in Technology a grassroots organization helping to grow the number of women in technology careers in Kansas City.
Why I don't use Apple products
Richard Stallman sums up the reasons I don't use Apple. No reason to duplicate.