Skip to content

Instantly share code, notes, and snippets.

View martin-mok's full-sized avatar

Martin martin-mok

  • /dev/null
View GitHub Profile
@martin-mok
martin-mok / firebase.tf
Created July 5, 2023 04:18 — forked from zebreus/firebase.tf
Terraform configuration for creating a firebase project with firestore, functions and storage
# firebase.tf https://gist.githubusercontent.com/Zebreus/906b8870e49586adfe8bd7bbff43f0a8/raw/firebase.tf
# Terraform configuration for creating a firebase project with firestore, functions and storage
# Unfinished
terraform {
required_providers {
google-beta = {
source = "hashicorp/google-beta"
version = "4.11.0"
}
@martin-mok
martin-mok / POSIX_commands.md
Created June 20, 2023 15:48 — forked from td-shi/POSIX_commands.md
About POSIX commands list

POSIX commands

You should refer the original page. The all copyrights of these documents belong to them.

Using frequent

filter

  • grep :: search a file for a pattern
package main
import (
"fmt"
"sync"
)
func main() {
letter, number := make(chan bool), make(chan bool)
@martin-mok
martin-mok / postgres-brew.md
Created April 20, 2021 03:37 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@martin-mok
martin-mok / git-maven-howto.md
Created February 21, 2021 02:02 — forked from fernandezpablo85/git-maven-howto.md
how to create your own maven repository on github

How to create a maven repository for your github project step by step

Clone your project in a separate folder

(note: replace ORGANIZATION and PROJECT)

git clone git clone [email protected]:ORGANIZATION/PROJECT.git my-repository

Cd into it

@martin-mok
martin-mok / workspace-clean.js
Created February 19, 2021 12:40
clean up folders and files by names in a workspace directory
#!/usr/bin/env node
let fs = require('fs');
let path = require('path');
let util = require('util');
let target = {
files: [
'workspace.xml',
],
dirs: [
@martin-mok
martin-mok / answer1.md
Created February 2, 2021 03:29 — forked from jackhftang/answer1.md
Oursky Developer Pre-Test

Question 1

Write a function that takes two arrays as input, each array contains a list of A-Z; Your program should return True if the 2nd array is a subset of 1st array, or False if not.

For example: isSubset([A,B,C,D,E], [A,E,D]) = true isSubset([A,B,C,D,E], [A,D,Z]) = false isSubset([A,D,E], [A,A,D,E]) = true

@martin-mok
martin-mok / s3.js
Created December 5, 2020 17:17 — forked from skhatri/s3.js
NodeJS AWS S3 list/clear/delete buckets.
module.exports = {
deleteObject: function (client, deleteParams) {
client.deleteObject(deleteParams, function (err, data) {
if (err) {
console.log("delete err " + deleteParams.Key);
} else {
console.log("deleted " + deleteParams.Key);
}
});
},
@martin-mok
martin-mok / buffer-base64.js
Created December 5, 2020 16:43
buffer - base64 in nodejs
//base64 to buffer
const b64string = /* whatever */;
const buff = Buffer.from(b64string, 'base64');
//buffer to base64
let data = "Hello World";
let buff = new Buffer(data);
let base64data = buff.toString('base64');
@martin-mok
martin-mok / pil_s3.py
Created December 3, 2020 09:04 — forked from ghandic/pil_s3.py
Load image from S3 directly into memory as PIL image and write to S3 directly from memory from PIL image
import boto3
from PIL import Image
from io import BytesIO
import os
class S3ImagesInvalidExtension(Exception):
pass
class S3ImagesUploadFailed(Exception):
pass