Skip to content

Instantly share code, notes, and snippets.

View slamer59's full-sized avatar

Thomas PEDOT slamer59

  • Toulouse, FRANCE
View GitHub Profile
@davelevine
davelevine / how-to-cache-b2-content-with-cloudflare.md
Last active August 21, 2024 18:11
How to Properly Cache Content Hosted on Backblaze B2 with Cloudflare

How to Properly Cache Content Hosted on Backblaze B2

Summary

Because I use Cloudflare to manage my domains and Backblaze for backups, it only made sense to take advantage of their Bandwidth Alliance for creating my own CDN. This has been incredibly helpful for image hosting for this knowledge base, however, I recently noticed that caching wasn't working as it should.

The Problem

The overall problem started when I was adding a parking page for a domain I recently purchased. The background image was hosted on B2 and the image was supposed to be cached by Cloudflare. However, each time the page loaded, it would pull the image from the origin instead of the cache. I checked this on my knowledge base and found it was doing the same thing.

@projetnumero9
projetnumero9 / Generate diagram legend.ajs
Created December 9, 2020 18:32
#jArchi Generate a legend for the selected view, based on the concept types currently used
//
// Generate diagram legend
//
// 2020 David GERARD
//
// For a selected view, create a group named 'Legend', in which will be nested for each concepts type found in view
// - a concept, specifically sized to show the pictogram
// - a note, to be used to name or explain the concept specifically in the view, hence preventing to rename the concept
// That way,
// - a model will be a bit polluted but with a specific set of concepts, for legend purpose, prefixed so easily identifiable
@pradishb
pradishb / tasks.json
Created September 11, 2020 17:25
vscode-autoflake-remove-all-unused-imports-task
{
"version": "2.0.0",
"tasks": [
{
"label": "autoflake-remove-all-unused-imports",
"type": "shell",
"command": "${config:python.pythonPath}",
"args": [
"-m",
"autoflake",
@GuiMarthe
GuiMarthe / pandas_caching_decorator.py
Last active November 15, 2023 19:10
This decorator caches a pandas.DataFrame returning function. It saves the pandas.DataFrame in a parquet file in the cache_dir.
import pandas as pd
from pathlib import Path
from functools import wraps
def cache_pandas_result(cache_dir, hard_reset: bool):
'''
This decorator caches a pandas.DataFrame returning function.
It saves the pandas.DataFrame in a parquet file in the cache_dir.
It uses the following naming scheme for the caching files:
@xavArtley
xavArtley / WaitBarsTests.ipynb
Created December 22, 2018 21:36
Panel wait bars tests
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.
@gbaman
gbaman / graphql_example.py
Created November 1, 2017 00:18
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
@cdelaitre
cdelaitre / docker-compose-tick.yml
Last active March 22, 2021 20:01
Monitor Docker Swarm with the InfluxData TICK Stack
version: '3'
services:
# FRONT
chronograf:
# Full tag list: https://hub.docker.com/r/library/chronograf/tags/
image: chronograf
deploy:
replicas: 1
placement:
constraints:
@magnetikonline
magnetikonline / README.md
Last active October 10, 2024 17:31
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script which will:

  • Iterate all commits made within a Git repository.