Skip to content

Instantly share code, notes, and snippets.

@janto
janto / cloudflare_delete_deployments.js
Last active April 23, 2025 14:31
chrome console script to delete old cloudflare deployments from cloudflare dashboard. created with chatgpt. run from project Deployments page. set MAX_DELETIONS to ramp it up. USE AT OWN RISK!
(() => {
const MAX_DELETIONS = 20;
const delayBetweenDeletions = 5000;
const retryDelay = 1000;
const maxRetries = 6;
const sleep = ms => new Promise(r => setTimeout(r, ms));
const findButtonByText = (text) =>
[...document.querySelectorAll('button')]
@janto
janto / cog_markdown_v3.txt
Last active May 14, 2024 19:32
cog_markdown_v3
<!-- [[[cog
import cog
def cog_outl_fenced(item):
cog.outl(f"```python\n{item}\n```")
def fenced_exec(code, inter="which prints"):
cog_outl_fenced(code.strip())
cog.outl()
cog.outl(inter)
cog.outl()
@janto
janto / cog_markdown_v2
Last active May 14, 2024 19:32
python in markdown with output
<!-- [[[cog
import cog
_print = print # save print
def print(item):
cog.outl("```python\n{}\n```".format(repr(item)))
exec("\n".join('''
-->
```python
print(1+1)
```
@janto
janto / cog_markdown
Created November 27, 2020 09:00
markdown with python code and results using cog
This is a markdown file with some cog wrapped Python code...
<!-- [[[cog
# your actual code goes here:
code = """
def f():
return "cog is awesome"
result = f()
"""