Skip to content

Instantly share code, notes, and snippets.

View stephenleo's full-sized avatar
🌟

Marie Stephen Leo stephenleo

🌟
View GitHub Profile
@stephenleo
stephenleo / 00_the_definitive_guide.md
Last active May 7, 2024 13:19
[Medium] The Definitive Guide to Structured Data Parsing with GPT3.5 in Complex Problems

The Definitive Guide to Structured Data Parsing with OpenAI GPT 3.5 in Complex Problems

Code for the Medium post

@stephenleo
stephenleo / 00_Semantic_Caching_in_Generative_AI_Chatbots.md
Last active March 11, 2024 00:55
[Medium] Semantic Caching in Generative AI Chatbots

Semantic Caching in Generative AI Chatbots

Code for the Medium post

@stephenleo
stephenleo / 01_bigquery.md
Last active April 21, 2023 01:52
DataEngineering

Big Query and SQL Hacks

  1. Use QUALIFY to filter rows after a window function. It's way more computationally efficient than using a CTE.

    SELECT RANK() OVER (PARTITION BY product_id ORDER BY rating DESC) AS rank 
    FROM table
    QUALIFY rank = 1
    
@stephenleo
stephenleo / 00_arxiv_semantic_paper_search.md
Last active March 22, 2023 21:50
[Medium] ArXiv Semantic Paper Search

ArXiv Semantic Paper Search

  • Code from the Medium post Link
@stephenleo
stephenleo / 00_sts.md
Last active February 17, 2024 08:32
[Medium] Semantic Textual Similariy

Semantic Textual Similarity

Code for the Medium post Link

@stephenleo
stephenleo / 01_DBS.md
Last active April 14, 2022 11:44
Interview

DBS (Development Bank of Singapore) Data Analyst Interview

  1. Python puzzle
    • Given a $2 \times 1$ non-negative integer array $\vec{a}$ and a $1 \times n$ integer array $\vec{b}$, write a function to return a $2 \times n$ logical matrix $x_{ij}$ such that $\sum_{j=1}^{n}x_{ij} = a_i$ and $\sum_{i=1}^{2}x_{ij} = b_j$. If there is no working matrix, please return string "impossible" (15 mins).
    • What is logical matrix? This is a matrix that $x_{ij} \in {0,1}$
    • Example: $\vec{a} = \begin{bmatrix} 3 \ 2\end{bmatrix}$, $\vec{b} = \begin{bmatrix} 2 & 1 & 1 & 0 & 1\end{bmatrix}$, one possible matrix is $\begin{bmatrix} 1 & 1 & 1 & 0 & 0 \ 1 & 0 & 0 & 0 & 1\end{bmatrix}$
    • Solution:
      import numpy as np
      
@stephenleo
stephenleo / 00_make_money_on_the_side_with_data_science.md
Last active March 22, 2022 12:53
[Medium] Make Money on the side with Data Science!

Make Money on the side with Data Science!

Code for the Medium post Link

@stephenleo
stephenleo / 00_Supercharged_Semantic_Similarity_Search_in_Production.md
Last active April 1, 2024 12:45
[Medium] Supercharged Semantic Similarity Search in Production

Supercharged Semantic Similarity Search in Production

Code for the Medium post Link

@stephenleo
stephenleo / 00_Python.md
Last active January 10, 2024 04:16
Python

Python

A collection of useful Python snippets

@stephenleo
stephenleo / 01_useful_commands.md
Last active February 3, 2022 08:17
ElasticSearch

Useful ES commands

  1. Check available nodes: curl 'http://<ip_address>:9200/_cat/nodes?v'
  2. Check available indices: curl 'http://<ip_address>:9200/_cat/indices?v'
  3. Delete a specific index: curl -X DELETE 'http://:9200/?pretty'