Skip to main content

Posts

Quẻ bói Bo gou 卜卦

Bo gua Que boi lyrics
Recent posts

Ubuntu simple avoid bash history by extra space at the command beginning

I randomly found that with extra space at the beginning of command, bash shell do not record its history. nickfarrow :dev$ echo "Test history" #space at beginning Test history nickfarrow :dev$  echo "test history #2" test history #2 nickfarrow :dev$   echo "test history #3" test history #3 $ history => only show first command without extra space 2215  echo "Test history" And when use UP key  ↑, it only show command without extra space. I am using Ubuntu 18 (VirtualBox) nickfarrow :dev$ uname -a Linux nickfarrow-VirtualBox 5.4.0-120-generic #136~18.04.1-Ubuntu SMP Fri Jun 10 18:00:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

AWS CloudFront base64 file upload randomly got 502 Bad Gateway error

I have build a upload function for my customer. Due to SQL injection prevent, some of my customer images got blocked by CloudFront. But instead of trying to manually clean these injection, customer want normal upload. (I can use some tool like imagemagick to convert back and ford png/jpg for example to clean injection part). So I ended up by using base64 encoding and custom jQuery fileupload (blueimp). This lead to some other problems, mostly randomly got 502 error on batch of 200 files upload. https://stackoverflow.com/questions/20664018/cloudfront-custom-origin-distribution-returns-502-error-the-request-could-not-b https://www.tessian.com/blog/how-to-fix-http-502-errors/ I had a similar issue recently which turned out to be due to ssl_ciphers that I was using. From http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html, "CloudFront forwards HTTPS requests to the origin server using the SSLv3 or TLSv1 protocols and the AES128

Notes on Shopify Theme dev - multiple themes and environment

  theme deploy --env=development => config.yml can store many config rather than dev https://github.com/shopify-graveyard/shopify_theme/issues/115 Understanding Shopify product data structure. From this understand we can match our product, business logic to its. On the other hand we can copy the idea of Shopify or WooCommerce design onto our product design. Product <= Variants Product <= product options Product <=> Collection Collect "table" structure and data (mapping product <=> collection). Product_variants. https://shopify.dev/api/liquid/objects/product Returns the variant object of the selected variant. The selected variant is based on the URL parameter variant. If there is no selected variant, then the first available variant is returned. For a variant to be available, its variant.inventory_quantity must be greater than zero or variant.inventory_policy must be set to continue. Products   id: 5609466331285    Options ["AXLE", "PATTERN/

Notes on csv handling with bash

  https://stackoverflow.com/questions/2535255/fastest-way-convert-tab-delimited-file-to-csv-in-linux grep -n ^$ /path/to/file ^$ start end => mean blank line import sys import csv tabin = csv.reader(sys.stdin, dialect=csv.excel_tab) commaout = csv.writer(sys.stdout, dialect=csv.excel) for row in tabin: commaout.writerow(row) Run it from a shell as follows: python script.py < input.tsv > output.csv