This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Dynamic and Adaptive Python Environment in a Bubblewrap Sandbox | |
Overview: | |
This project demonstrates a minimal, safe, and self-contained Python execution | |
environment using bubblewrap (bwrap) and uv. The goal is to provide a lightweight | |
alternative to Docker for running agent code—in this case, dynamically generated | |
Python code along with its dependencies—within an isolated sandbox. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tweepy | |
import os | |
from typing import List, Optional | |
class TwitterClient: | |
def __init__( | |
self, | |
consumer_key: str, | |
consumer_secret: str, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import duckdb | |
import fabduckdb | |
import gspread | |
import pandas as pd | |
def read_gsheet(service_account_json_path: str, gsheets_url: str, worksheet_name: str) -> pd.DataFrame: | |
gc = gspread.service_account(filename=service_account_json_path, scopes=gspread.auth.READONLY_SCOPES) | |
gsheet = gc.open_by_url(gsheets_url) | |
data = gsheet.worksheet(worksheet_name).get_all_records() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lerp(a, b, t): | |
return (b - a) * t + a | |
def bias(i, x, beta): | |
return 1 - jnp.asarray(beta, x.dtype) ** (i + 1) | |
@optimizer | |
def adam(step_size, b1=0.9, b2=0.999, eps=1e-8) -> OptimizerResult: | |
"""Construct optimizer triple for Adam. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function video_to_gif { | |
local input_video_path="$1" | |
local output_gif_path="$2" | |
local fps="${3:-10}" | |
local scale="${4:-1080}" | |
local loop="${5:-0}" | |
ffmpeg -i "${input_video_path}" -vf "setpts=PTS/1,fps=${fps},scale=${scale}:-2:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop $loop "${output_gif_path}" | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Custom table expectation which checks whether the row count is greater than the row count of other tables. | |
There are different ways to compare the row counts: | |
* With absolute values, if one row count value of the other tables is greater than the current then the validation | |
fails, | |
* With mean values, if the mean of value of the other tables row count is greater than the current row count then | |
the validation fails. | |
""" | |
from copy import deepcopy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick and easy one line command to setup a global .gitignore file and ignore macOS .DS_store files globally | |
git config --global core.excludesfile "~/.gitignore" && echo .DS_Store >> ~/.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//colruyt datascience homework assignment in Neo4j | |
// from: https://github.com/MarkiesFredje/data-engineering-exercise/blob/master/data_engineer_exercise.ipynb | |
// json file download location: https://ecgplacesmw.colruytgroup.com/ecgplacesmw/v3/nl/places/filter/clp-places | |
//import into neo4j using apoc | |
//create indexes and constraint | |
create index on :Address(streetName); | |
create index on :City(name); |
NewerOlder