Skip to content

Instantly share code, notes, and snippets.

View albertlieyingadrian's full-sized avatar
🤠

Albert Lie 이영덕 albertlieyingadrian

🤠
View GitHub Profile
@markhng525
markhng525 / ai-engineer-summit-workshop-2023.ipynb
Last active June 25, 2024 00:52
ai-engineer-summit-workshop-2023.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kettanaito
kettanaito / README.md
Last active November 15, 2024 15:46
Chromium on Vercel (serveless)

Chromium on Vercel (serverless)

This is an up-to-date guide on running Chromium in Vercel serverless functions in 2022. What you will read below is the result of two days of research, debugging, 100+ failed deployments, and a little bit of stress.

Getting started

Step 1: Install dependencies

Use chrome-aws-lambda that comes with Chromium pre-configured to run in serverless, and puppeteer-core due to the smaller size of Chromium distributive.

@ndavis
ndavis / oktaLogin.js
Created November 7, 2019 03:38
Cypress Custom Command for Okta Login
Cypress.Commands.add('loginOkta', () => {
const optionsSessionToken = {
method: 'POST',
url: Cypress.env('session_token_url'),
body: {
username: Cypress.env('username'),
password: Cypress.env('password'),
options: {
warnBeforePasswordExpired: 'true'
}
@kevinwucodes
kevinwucodes / readme.md
Last active February 13, 2024 18:32
daily coding problem #33: Compute the running median of a sequence of numbers

Good morning! Here's your coding interview problem for today.

This problem was asked by Microsoft.

Compute the running median of a sequence of numbers. That is, given a stream of numbers, print out the median of the list so far on each new element.

Recall that the median of an even-numbered list is the average of the two middle numbers.

For example, given the sequence [2, 1, 5, 7, 2, 0, 5], your algorithm should print out:

@yitonghe00
yitonghe00 / 373. Find K Pairs with Smallest Sums (#1 Heap).java
Last active May 28, 2021 09:50
373. Find K Pairs with Smallest Sums (https://leetcode.com/problems/find-k-pairs-with-smallest-sums/description/): You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from the first array and one element from the second array. Find the k pairs (u1,v1),(u2,…
//Heap solution: Same sum matrix with 378
//Time: O(klogk)
//Space: O(k)
class Solution {
public List<int[]> kSmallestPairs(int[] nums1, int[] nums2, int k) {
List<int[]> ans = new ArrayList<>();
if(nums1.length == 0 || nums2.length == 0) return ans;
//Sum matrix: nums1 is the row title, nums2 is the column title
//Build a minHeap of the elements from the first row
PriorityQueue<Tuple> minHeap = new PriorityQueue<>();
@nikhita
nikhita / update-golang.md
Last active November 15, 2024 08:50
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@001101
001101 / accounting.sql
Created February 18, 2017 09:08 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@ryanwinchester
ryanwinchester / install_elixir_phoenix.sh
Last active March 26, 2024 17:01
Install Elixir and Phoenix on macOS
# Update brew
brew update
# Need postgres
brew install postgresql
# Install elixir
brew install elixir
# Install hex package manager
@briangershon
briangershon / gist:fa9feb08e6a65d52bdc35c738d8cf104
Created January 8, 2017 07:57
Log Request Body for Debugging (golang)
buf, bodyErr := ioutil.ReadAll(r.Body)
if bodyErr != nil {
log.Print("bodyErr ", bodyErr.Error())
http.Error(w, bodyErr.Error(), http.StatusInternalServerError)
return
}
rdr1 := ioutil.NopCloser(bytes.NewBuffer(buf))
rdr2 := ioutil.NopCloser(bytes.NewBuffer(buf))
log.Printf("BODY: %q", rdr1)