Skip to content

Instantly share code, notes, and snippets.

@Zemke
Zemke / np_grid.py
Last active August 2, 2022 19:03
image grid with numpy
View np_grid.py
# unordered
# c = color channel if available
np.concatenate(np.reshape(img, (img_rows,-1,img_width,c), axis=1)
# ordered
# n = number of tiled images that should make up a row in the grid
np.vstack([np.concatenate(img[i:i+n], axis=1) for i in range(0, len(img), n)])
View dev.sql
set search_path = "db10838396-cwt";
CREATE OR REPLACE FUNCTION timeline(bigint)
RETURNS TABLE
(
timeline text
)
ROWS 1
LANGUAGE SQL
AS
@Zemke
Zemke / beautiful-soup.py
Last active March 30, 2018 18:02
Takes an HTML file or a path to recursively associate input fields and labels using `id` and `for` attributes.
View beautiful-soup.py
import os
import re
import sys
from typing import IO
from bs4 import BeautifulSoup
from bs4.element import Tag
if len(sys.argv) == 2:
argv_path = sys.argv[1]