Skip to main content

Posts

Showing posts from 2022

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

VirtualBox extend vdi disk size, RD Client extreme slow on Mac to Windows but faster with Ubuntu Virtual machine inside this Windows host.

https://askubuntu.com/questions/958114/resize-ubuntu-dev-sda1-partition-in-virtualbox-vmdk-when-dev-sda-is-already-la RD Client on Mac sometime cause issues, recently update seem make it hyper lagging to almost unusable. Android RD Client still work well. Restart Windows (remote PC) not help, restart, shutdown then start Mac not help. Strangely, Ubuntu virtualbox machine inside this Windows work much faster when remoting.

Notes on some legal apps and which I can develop a free/personal version

https://www.nivancontent.com/best-legal-apps-for-lawyers #4 https://www.goodreader.com/ https://www.fastcase.com/pricing-plans/   Now it seem not free anymore like many other app enter later phase of service. Data collection and organizing seem very useful and can be make profit from it. So try collect data about Road Safety or Trash issues for other use. This seem much more valuable than making some app that more likely already exist.

Unix grep color

  https://askubuntu.com/questions/1042234/modifying-the-color-of-grep https://superuser.com/questions/416835/how-can-i-grep-with-color-in-mac-os-xs-terminal export GREP_OPTIONS='--color=always' export GREP_COLOR='1;31;49' source ~/.bash_profile