Skip to content

Instantly share code, notes, and snippets.

@louischan
louischan / lambda-php-runtime.md
Created December 20, 2020 14:48
AWS Lambda PHP 8 Custom Runtime (Amazon Linux 2)
  1. Compile PHP in a Amazon Linux 2 machine
sudo yum update -y
mkdir php
curl -sL https://github.com/php/php-src/archive/php-8.0.0.tar.gz | tar -xvz
cd php-src-php-8.0.0/
sudo yum install -y gcc autoconf bison re2c libcurl-devel libxml2-devel openssl-devel sqlite-devel oniguruma-devel libzip-devel bzip2-devel
./buildconf --force
# Run ./configure --help for full list of options
./configure --prefix=/home/ec2-user/php/ --with-openssl --with-curl --with-zlib --with-zip --enable-mbstring --enable-cli
@louischan
louischan / rand.sh
Created April 26, 2019 17:19
Minimal bash shell random string/number generator
#!/bin/bash
openssl rand -base64 "${2:-50}" | tr -cd "[:${1:-digit}:]"; echo
# Usage examples:
# rand [digit | alpha | alnum] [num_bytes]
# $ rand
# $ rand alnum
# $ rand digit 200
@louischan
louischan / reset-viewport.md
Created February 8, 2019 17:32
Reset viewport in iPhone Safari

This JavaScript helper (bookmark) for iOS Safari helps you switch from fixed width mobile view to desktop view.

  1. In Safari, add a random web page to your bookmark

  2. Open bookmarks list, edit the newly added bookmark

  3. Change the bookmark name to "Zoom Out"

  4. Change the bookmark URL to javascript:var%20el=document.querySelector('meta%5Bname=viewport%5D');if(el)el.setAttribute('content','');

@louischan
louischan / firefox-gestures.md
Last active March 1, 2022 16:53
Enable Multi-touch Gestures in Firefox
  1. Open about:config in Firefox
  2. Set the following values
  3. Restart Firefox
browser.snapshots.limit           5
browser.gesture.pinch.in          cmd_fullZoomReduce
browser.gesture.pinch.out         cmd_fullZoomEnlarge
browser.gesture.pinch.latched     false
browser.gesture.pinch.threshold 35