Skip to main content

Posts

Setting up a new laptop

This is mostly a self note for the next time I'm doing a fresh install of my laptop. Which I do about once a year to catch up with the latest macOS version. I feel like a new install has better performance then an in place upgrade. System Preferences The first thing that I do on any laptop is to make sure tap to click is enabled 🤣 Also related to the trackpad, three finger drag is also needed... macOS has tons of Apple icons in the default Dock. I get rid of most of them and also make it a bit smaller, align left, disable magnification / minimizing / animation. Some what related to the animations, I often reduce motion / increase contrast these days. It feels easier on the eyes. While I'm still in there, I also disable autocorrect and most of Spotlight indeces. Applications App Store I usually pre-download the installation packages before installing to save time but there are a few apps that need to be downloaded from the store. Xcode is the most important one, and it is huge.
Recent posts

GME? WSB? Short squeeze là cái quái gì vậy?

Trong khi các nhà đầu tư trên Facebook đau khổ vì VN-Index giảm điểm thì bên Mẽo dồn dập những cái tên như GameStop, WallStreetBets rồi các khái niệm short squeeze, options, etc. Sau khi đọc tá lả các nguồn thì mình tổng hợp lại cho các bạn đọc giải trí (đổi khẩu vị đi chứ nhiều tin bệnh dịch quá). Các nguồn tham khảo để ở cuối nhé. 1 GameStop là công ty chuyên bán băng đĩa, máy chơi game thành lập từ 1984 và lên sàn New York năm 2002 với mã GME. Ngày trước ăn nên làm ra, được mua đi bán lại nhiều lần nhưng gần đây thì bết bát do gamer mua online cho nhanh, cả năm vừa rồi cũng giãn cách nên không ai đi trung tâm thương mại / tiệm game làm gì… GME đã rẻ bèo rồi lại còn bị đánh giá là sẽ còn giảm nữa nên bị các nhà đầu cơ bán khống 71.2m cổ phiếu trong khi chỉ có 69.7m cổ phiếu lưu hành. 2 Bán khống ( short ) cổ phiếu thường sẽ làm như thế này: nhà đầu tư A dự đoán cố phiếu X có giá $10 và sẽ còn giảm nên quyết định cọc tiền (collateral) để mượn cổ phiếu bán ra thị trường, chờ X tụt giá

200 stars!

Yay! flutter_widget_from_html .

Flutter: Fixing Firebase header not found with Notification Service Extension

If you follow the FCM tutorial Send an image in the notification payload and encountered this error message: 'FirebaseMessaging/FirebaseMessaging.h' file not found You are on the right place, I'm going to show you how to fix it. My app was working fine but one day it stopped compiling. Apparently Flutter 1.20 changed the way it uses CocoaPod so the service extension no longer has the proper library configured. After some tinkering, I came up with this pod config, it has to be added to ios/Podfile below the main Runner target. target 'FcmImage' do use_frameworks! use_modular_headers! require File.expand_path('../.symlinks/plugins/firebase_core/ios/firebase_sdk_version.rb', __FILE__) firebase_sdk_version = firebase_sdk_version! pod 'Firebase/Messaging', "~> #{firebase_sdk_version}" end FcmImage is my extension name, replace it with yours We can use a hardcoded version for Firebase/Messaging pod but doing so m

Making GIF of iOS Simulator without additional apps

This is how I did it: open Terminal and execute this command: ``` xcrun simctl io booted recordVideo \   --code=h264 \   --force "$( date +%Y%m%d%H%M%S ).mov" ``` Running this will record the Simulator screen until you press ` Control+C `. The filename will be something like ` 20200730095757.mov `. The next step is to convert this video into GIF, FFMPEG is required for this. You can either install it via Homebrew but I prefer running it in a Docker container, something like this: ``` docker run --rm -it -v $PWD:/data -w /data --entrypoint /bin/bash jrottenberg/ffmpeg ``` Once you have FFMPEG installed or are inside the container, execute this command: ``` ffmpeg -i 20200730095757.mov \   -vf "fps=fps=5,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \   20200730095757.gif ``` I have played around with the command line arguments and came up with those. Basically it will create a decent GIF to use in issue report etc. Because of the low fra

Running phpinfo to test Kubernetes ingress and Let's Encrypt certificate

For new cluster, I usually deploy a simple phpinfo app to test that the happy-path works as expected. The PHP service and deployment is pretty simple: The Docker image is basically a php:apache image with a single index.php file . Next, setup the ingress and issuer (I'm using ingress-nginx and cert-manager FYI): And voila.

Amazon SES notes

Amazon IAM policy to restrict sending email from a single address {   "Version": "2012-10-17",   "Statement": [     {            "Effect": "Allow",        "Action": "ses:SendRawEmail",        "Resource": "*",        "Condition": {          "StringLike": {            "ses:FromAddress": "username@domain.com"          }        }      }   ] } Replace ` username@domain.com ` with ` *@domain.com ` to allow sending from any addresses. Generate SMTP password from the secret access key Official document is available at  docs.aws.amazon.com . Usage is like this: ./ses.py --secret DmxxxOY --region us-west-2 Test SMTP credentials I use the swaks script (source:  wiert.me ): brew install swaks swaks -tls --to xxx@gmail.com \   --from username@domain.com \   --server email-smtp.us-west-2.amazonaws.com \   --auth-user AKxxxOP If