Skip to content

Instantly share code, notes, and snippets.

View michaellzc's full-sized avatar
🙃
...

Michael Lin michaellzc

🙃
...
View GitHub Profile
@michaellzc
michaellzc / iphone-stock-spider.py
Last active September 25, 2023 03:53
Check iPhone 15 Pro Max Stock in Vancouver, Canada
"""
Usage:
# Show help
# Look up part number and store number
python main.py --help
# Check iPhone 15 Pro Max 512GB Natural Titanium at Apple Store Richmond Centre (default)
python main.py -model MTUG3VC/A -store R421
"""
storageClass:
create: false
name: standard
sourcegraph:
localDevMode: true

Keybase proof

I hereby claim:

  • I am michaellzc on github.
  • I am mlzc (https://keybase.io/mlzc) on keybase.
  • I have a public key whose fingerprint is 50B5 BEAA 233C 87C1 D9F8 5917 B1F5 A78E 7268 AE09

To claim this, I am signing this object:

@michaellzc
michaellzc / index.ts
Created May 22, 2020 20:44
Prisma schema DMMF
import fs from 'fs';
import {getDMMF} from '@prisma/sdk';
const schemaPath = '...';
(async function () {
const schema = fs.readFileSync(schemaPath, 'utf-8');
const dmmf = await getDMMF({datamodel: schema});
})();
@michaellzc
michaellzc / machine.js
Created April 26, 2020 18:41
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
"""
Run cf-terraforming record > cf_records.tf to generate cf_recores.tf file.
"""
import hcl
import subprocess
with open('cf_records.tf', 'r') as f:
obj = hcl.load(f)
records : dict = obj['resource']['cloudflare_record']
function foo(b) {
console.log(this.a, b);
return this.a + b;
}
var context = {
a: 2,
};
var fooFake = foo;
// 'use strict';
function foo() { console.log(this.a); }
foo.a = 1;
var context = {
a: 1
}
foo(); // undefined
@michaellzc
michaellzc / swagger_api.yaml
Last active January 26, 2019 23:23
CMPUT 404 Project REST API - OpenAPI Spec
openapi: 3.0.0
servers:
- url: /
info:
title: Social Distribution Project REST API
description: A Social Distribution Project
version: 0.2.8
tags:
- name: post
description: Blog post operations
from imaplib import IMAP4_SSL
import email
import smtplib
import time
email_addr = 'your@gmail.com' # your gmail username, address
app_password = 'topsecret' # your google app password
def main():
mail = IMAP4_SSL('imap.gmail.com')