Skip to content

Instantly share code, notes, and snippets.

View poyea's full-sized avatar
🎆
I may be slow to respond.

John Law poyea

🎆
I may be slow to respond.
  • London | Hong Kong
  • 16:50 (UTC +01:00)
View GitHub Profile
@poyea
poyea / coronaflight.json
Last active December 30, 2022 01:00
coronaflight.json
{
"0": {
"flight": "AI314",
"departure": [
"New",
"Delhi"
],
"seats": [
"Unknown"
],
This file has been truncated, but you can view the full file.
{
"0": {
"flight": "CX838",
"path": "Hong Kong → Vancouver",
"seats": [
"15D",
"15G"
],
"date": "06/03/2020"
},
@poyea
poyea / ternary-balance.cpp
Last active May 6, 2020 01:25
CSC7426 First Lesson
#include <cmath>
#include <iostream>
#include <unordered_set>
#include <vector>
using namespace std;
vector<int> plusTo(vector<int> original, int position)
{

Keybase proof

I hereby claim:

  • I am poyea on github.
  • I am poyea (https://keybase.io/poyea) on keybase.
  • I have a public key whose fingerprint is C059 C6FC CF55 BEF4 DC94 EFC6 534F F4D1 3CAD 8820

To claim this, I am signing this object:

@poyea
poyea / 4160-q4b1b2.py
Last active December 16, 2019 08:00
Gradient direction and magnitude at all pixels of an image
# @poyea - https://github.com/poyea
# 𝕴𝕰𝕽𝕲𝟒𝟏𝟔𝟎 - 𝕳𝖂𝟐𝕼𝟒𝕭𝟏&𝟐 Ŧคɭɭ 2019
import numpy as np
from scipy.signal import correlate, convolve2d
np.seterr(divide='ignore', invalid='ignore') # ignore error messages for now
np.set_printoptions(precision=4) # 4 decimal places
PADDING = 'valid' # or 'full', I use 'valid' here
I = np.array([[1, 1, 0, 0, 0, 0], # the image
[1, 1, 0, 0, 0, 0],
@poyea
poyea / popo.jpg
Last active July 22, 2019 04:47
Hong Kong police = gang
popo.jpg
@poyea
poyea / apache.yaml
Last active July 4, 2019 02:31
Single-port Apache & NGINX web server deployment + service on Kubernetes cluster
# kubectl apply -f apache.yaml
# https://github.com/poyea
apiVersion: apps/v1
kind: Deployment
metadata:
name: apache-deployment
spec:
selector:
matchLabels:
app: apache
#include<iostream>
using namespace std;
int gcd(int x, int y){ return x%y==0?y:gcd(y,x%y); }
int main(){ cout << gcd(27258068,43175188) << endl; return 0; } // print a special number