Skip to content

Instantly share code, notes, and snippets.

View jayliew's full-sized avatar

Jay Liew jayliew

View GitHub Profile
@jayliew
jayliew / flexbox-css-cheat.md
Created March 7, 2024 19:12
Flexbox CSS cheat

In this simplified example:

  • main axis = horizontal
  • cross axis = vertical
  • "thing" (made up nomenclature) = item

Properties on the "parent" (container)

justify-content

  • Specify where the extra space goes horizontally
@jayliew
jayliew / see_betty-web_placeholder.txt
Last active December 21, 2023 15:22
See Betty.com web placeholder
Welcome to
__ __ __
________ ___ / /_ ___ / /_/ /___ __
/ ___/ _ \/ _ \ / __ \/ _ \/ __/ __/ / / /
(__ ) __/ __/ / /_/ / __/ /_/ /_/ /_/ /
/____/\___/\___/ /_.___/\___/\__/\__/\__, /
/____/
More to follow.
███████╗███████╗███████╗ ██████╗ ███████╗████████╗████████╗██╗ ██╗
██╔════╝██╔════╝██╔════╝ ██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝╚██╗ ██╔╝
███████╗█████╗ █████╗ ██████╔╝█████╗ ██║ ██║ ╚████╔╝
╚════██║██╔══╝ ██╔══╝ ██╔══██╗██╔══╝ ██║ ██║ ╚██╔╝
███████║███████╗███████╗ ██████╔╝███████╗ ██║ ██║ ██║
╚══════╝╚══════╝╚══════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝
@jayliew
jayliew / scan.sh
Created March 9, 2021 04:07
network scan script using nc
#!/bin/bash
echo "First 3 IP octets: "
read net
echo "Start IP (last octet): "
read start_octet
echo "End IP (last octet): "
read end_octet
@jayliew
jayliew / bash_dictionary_cheat.sh
Created January 16, 2021 21:40
Cheat sheet for using a bash "dictionary". Also known as a hash or an associative array
#!/bin/bash
################################################################################
#
# Cheat sheet for using a bash "dictionary". Also known as a hash or
# associative array. Because the stone ages need modern data structures too.
#
# jayliew (a) jayliew (.) com
#
################################################################################
@jayliew
jayliew / robert_greene-mastery.md
Last active July 16, 2020 19:42
Robert Greene - Mastery. Talks at Google

Notes from Robert Green's talk at Google about his book titled "Mastery"

"Fight or flight" reaction, but intellectual

Min 27:00

Fear and anxiety generates a "fight or flight" response, even in an intellectual realm. It is a physiological response: our minds naturally narrow our focus into what is immediately present.

When confronted with new problems, new circumstances, or when we begin work on a project, learning something new, we're unconsciously plagued with insecurities and anxieties, and we don't like it. Mysteries, any contradiction, situations that are unfamiliar and ambiguous, and elude immediate understanding, all makes us uneasy.

@jayliew
jayliew / ramsey_beirne.md
Created June 4, 2018 13:41
ramsey beirne

Professionals exude success, and that was all the outside world saw, if it noticed Ramsey Beirne at all. Beirne would direct that a cold call open with, “Hi, we’re Ramsey Beirne, the leading retained executive search firm in high technology.”

His colleagues thought this was a bit much.

“Well, Dave, couldn’t one argue that—”

“We are. Go.”

If said to a client with sufficient force, it would not be questioned. And if a prospect laughed at the audacity of this little firm in Ossining and said, “So, let me ask you a question—how can you guys call yourself the leading firm?” Beirne and his colleagues would reply, “We brought in the COO of Central Point. We built the whole management team.” The prospect probably had never heard of Central Point Software, either, but Central Point must have been an important client for Ramsey Beirne to lay claim to it in the way that it did.

@jayliew
jayliew / barcode_scanner_raspbian.py
Created March 22, 2018 22:32
USB barcode scanner read in Python on Raspberry Pi Raspbian
# Props to user brechmos for sharing the code here: https://www.raspberrypi.org/forums/viewtopic.php?t=55100
# Tested with the following barcode scanner
# macbook# ioreg -p IOUSB
# <snip>
# | +-o WIT 122-UFS V2.03@14200000 <class AppleUSBDevice, id 0x10000c3c4, registered, matched, active, busy 0 (6 ms), retain 14>
# WIT 122-UFS V2.03:
# Product ID: 0x1010
# Vendor ID: 0x05fe (CHIC TECHNOLOGY CORP)
@jayliew
jayliew / gist:880d2948d7e0382580e471b44f4bc34f
Created January 9, 2018 18:57
Ubuntu 16.04 systemd service starter script
[Unit]
Description=SSH Tunnel for MySQL
After=network.target
[Service]
Restart=always
RestartSec=20
User=unprivilegedusername
ExecStart=/usr/bin/ssh -NT -o ServerAliveInterval=60 -L 3306:127.0.0.1:3306 username@hostactuallyrunningmysqld
@jayliew
jayliew / postgres.md
Last active January 17, 2024 18:48
postgres cheat / psql cheat

create user: CREATE ROLE username WITH LOGIN PASSWORD 'password';

show users: \du

create database: CREATE DATABASE databasename;

show databases: