Skip to content

Instantly share code, notes, and snippets.

View cast42's full-sized avatar

Lode Nachtergaele cast42

View GitHub Profile
This file has been truncated, but you can view the full file.
<?xml version="1.0"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" creator="AllTrails.com" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata>
<name><![CDATA[Leuven Rome GROF v2]]></name>
<desc><![CDATA[]]></desc>
<link href="http://www.alltrails.com">
<text>AllTrails, LLC</text>
</link>
<bounds minlat="41.90529" minlon="4.70136" maxlat="50.87941" maxlon="12.75231"/>
</metadata>
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "pandas",
# "scrub"
# ]
# ///
import sys
from skrub import TableReport
# https://github.com/andrewyng/aisuite/blob/main/examples/QnA_with_pdf.ipynb
import requests
import fitz
from io import BytesIO
# Link to paper in pdf format on the cost of avocados.
pdf_path = "https://arxiv.org/pdf/2104.04649"
pdf_text = ""
# Download PDF and load it into memory
@cast42
cast42 / downscale_videos.py
Created May 12, 2023 09:17
Rescale all mp4 files in --source-folder to 320 lines while keeping the source aspect ratio with ffmpeg and place rescaled videos in --destination-folder
"""Rescale all mp4 files in --source-folder to 320 lines while keeping the source aspect ratio
with ffmpeg and place rescaled videos in --destination-folder"""
import argparse
import subprocess
import logging
from datetime import datetime
from pathlib import Path
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cast42
cast42 / chaos.py
Last active August 17, 2023 12:40
Simone Conradi Chaos attractor in matplotlib
# Code from https://twitter.com/S_Conradi/status/1595324702008000512/photo/1
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# %config InlineBackend.figure_format = "retina"
def list2f(ifs):
@cast42
cast42 / section_2_1_fake_news.ipynb
Created March 21, 2022 17:46
Section_2_1_fake_news.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy
arr = [10, 386, 479, 627, 20, 523, 482, 483, 542, 699, 535, 617, 577, 471, 615, 583, 441, 562, 563, 527, 453, 530, 433, 541, 585, 704, 443, 569, 430, 637, 331, 511, 552, 496, 484, 566, 554, 472, 335, 440, 579, 341, 545, 615, 548, 604, 439, 556, 442, 461, 624, 611, 444, 578, 405, 487, 490, 496, 398, 512, 422, 455, 449, 432, 607, 679, 434, 597, 639, 565, 415, 486, 668, 414, 665, 763, 557, 304, 404, 454, 689, 610, 483, 441, 657, 590, 492, 476, 437, 483, 529, 363, 711, 543]
elements = numpy.array(arr)
mean = numpy.mean(elements, axis=0)
sd = numpy.std(elements, axis=0)
final_list = [x for x in final_list if (mean - 2 * sd < x < mean + 2 *sd)]
@cast42
cast42 / Basic timeseries exploration.ipynb
Last active August 10, 2018 01:16
Exploration of basic timeseries approach to forecast sales in the Rossman Kaggle competition
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.