Skip to content

Instantly share code, notes, and snippets.

@dberstein
dberstein / duration.py
Last active May 8, 2023 04:02
Python time duration as in golang
import re
import time
from datetime import datetime, timedelta
class DurationUnits:
Nanosecond = 1
Microsecond = 1000 * Nanosecond
Millisecond = 1000 * Microsecond
Second = 1000 * Millisecond
@dberstein
dberstein / download.php
Created November 29, 2024 12:56 — forked from nicklasos/download.php
Curl PHP multiple files downloading
<?php
function multiple_download(array $urls, $save_path = '/tmp')
{
$multi_handle = curl_multi_init();
$file_pointers = [];
$curl_handles = [];
// Add curl multi handles, one per file we don't already have
foreach ($urls as $key => $url) {
#!/usr/bin/env bash
set -eux
IMG="aider-wrap"
GEMINI_API_KEY="..."
tmpfile=$(mktemp)
trap 'rm -f "$tmpfile"' EXIT
exists() {