Skip to content

Instantly share code, notes, and snippets.

View yenson-lau's full-sized avatar

Yenson Lau yenson-lau

  • EvenUp
  • Toronto, ON, Canada
View GitHub Profile
@yenson-lau
yenson-lau / folderEmails.js
Last active May 26, 2023 03:08
Send all mails in a ProtonMail search query to any folder of your choosing
function waitForElm(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if ((document.querySelector(selector) !== undefined) &&
(document.querySelector(selector) !== null)) {
resolve(document.querySelector(selector));
@yenson-lau
yenson-lau / df_to_julia.py
Last active January 10, 2022 06:37
Convert Pandas DataFrame into Arrow bytestream, and process it with Julia
from julia.api import Julia
import pyarrow as pa
def process_dataframe_jl(df):
"""Process DataFrame in Julia; return the resulting DataFrame"""
bytes = df_to_arrowbytes(df) # convert df into Arrow bytestream
jl = Julia(compiled_modules=False) # create / get Julia instance
jl.eval('include("process_dataframe.jl"') # this script contains my Julia function
@yenson-lau
yenson-lau / process_dataframe.jl
Last active January 10, 2022 06:54
Process Arrow bytestream in Julia
using Arrow, DataFrames
using PyCall
"""
Convert the Arrow bytestream into a DataFrame, process it,
and return the resulting DataFrame as a Python bytestream.
"""
function process_arrowbytes( bytes::Vector{UInt8} )::PyObject
df = DataFrame(Arrow.Table(bytes)) # convert bytestream into a DataFrame
result = process_dataframe( df ) # run some arbitrary function