Skip to main content

Posts

Showing posts from April, 2021

Notes on complex business “illogic” that makes business software so difficult

Even if a company unifies the technology for integration, they run into problems with differences in business process and conceptual dissonance with the data. One division of the company may think a customer is someone with whom it has a current agreement; another division also counts those that had a contract but don’t any longer; another counts product sales but not service sales. That may sound easy to sort out, but when you have hundreds of records in which every field can have a subtly different meaning, the sheer size of the problem becomes a challenge—even if the only person who knows what the field really means is still with the company. (And, of course, all of this changes without warning.) As a result, data has to be constantly read, munged, and written in all sorts of different syntactic and semantic formats. Then there’s the matter of what comes under the term “business logic.” I find this a curious term because there are few things that are less logical than business logic

Shell Bash get datetime and format

https://stackoverflow.com/questions/1401482/yyyy-mm-dd-format-date-in-shell-script In bash (>=4.2) it is preferable to use printf's built-in date formatter (part of bash) rather than the external date (usually GNU date). As such: # put current date as yyyy-mm-dd in $date # -1 -> explicit current date, bash >=4.3 defaults to current time if not provided # -2 -> start time for shell printf -v date '%(%Y-%m-%d)T\n' -1  # put current date as yyyy-mm-dd HH:MM:SS in $date printf -v date '%(%Y-%m-%d %H:%M:%S)T\n' -1  # to print directly remove -v flag, as such: printf '%(%Y-%m-%d)T\n' -1 # -> current date printed to terminal In bash (<4.2): # put current date as yyyy-mm-dd in $date date=$(date '+%Y-%m-%d') # put current date as yyyy-mm-dd HH:MM:SS in $date date=$(date '+%Y-%m-%d %H:%M:%S') # print current date directly echo $(date '+%Y-%m-%d') Other available date formats can be viewed from the date man pages (for external

echo "not enough Space" >&2

https://stackoverflow.com/questions/23489934/echo-2-some-text-what-does-it-mean-in-shell-scripting To quickly explain what the others missed: echo "hey" >&2 > redirect standard output (implicit 1> ) & what comes next is a file descriptor, not a file (only for right hand side of >) 2 stderr file descriptor number Redirect stdout from echo command to stderr. (If you were to useecho "hey" >2 you would output hey to a file called 2) https://stackoverflow.com/questions/41127585/shell-how-to-check-available-space-and-exit-if-not-enough #!/bin/bash # Note: Numbers are 1024-byte units on Linux, #       and 512-byte units on macOS. reqSpace=100000000 availSpace=$(df "$HOME" | awk 'NR==2 { print $4 }') if (( availSpace < reqSpace )); then   echo "not enough Space" >&2   exit 1 fi

AWS S3 Glacier

https://docs.aws.amazon.com/cli/latest/userguide/cli-services-glacier.html => Using aws glacier CLI (vs aws s3). This is different with aws s3 with --storage-class GLACIER. See  https://www.reddit.com/r/aws/comments/7y9z7f/whats_the_difference_between_s3_glacier_storage/ What's the difference between S3 Glacier storage class, and the Glacier vaults? I'm confused about the difference between: storing data in an S3 bucket, marked as storage class "GLACIER" creating a Glacier vault in the AWS console and using that instead https://stackoverflow.com/questions/62121247/aws-s3-glacier-upload-archive-taking-a-long-time-to-finish-execution-ways-to-c https://ystatit.medium.com/what-is-aws-s3-glacierstagingstorage-cost-a0c0be216589 https://stackoverflow.com/questions/44912550/multipart-upload-to-amazon-glacier-content-range-incompatible-with-content-leng https://stackoverflow.com/questions/46111372/change-s3-bucket-storage-class-to-s3-infrequent-access https://docs.aws.amazo

Restrict user access in Linux

 https://unix.stackexchange.com/questions/137037/restrict-user-access-in-linux https://superuser.com/questions/581194/setting-correct-permissions-for-uploading-files https://en.wikipedia.org/wiki/Restricted_shell https://unix.stackexchange.com/questions/208960/how-to-restrict-a-user-to-one-folder-and-not-allow-them-to-move-out-his-folder https://ostechnix.com/the-right-way-to-edit-etc-passwd-and-etc-group-files-in-linux/