- Add the
worker.js
code to a new Cloudflare Worker - Set up a worker for your domain than responds to
/tunnel/*
and point it to your new worker - Add the Sentry script to your html but replace
https://browser.sentry-cdn.com/
with./tunnel/
- Eg.
<script src="./tunnel/6.9.0/bundle.min.js"></script>
- Eg.
init
Sentry with thetunnel
option set to/tunnel/
- Eg.
Sentry.init({ dsn: "__DSN__", tunnel: "/tunnel/" })
- Eg.
- Rejoice at how everything now works with ad blockers
const API_URL = "https://api.openai.com/v1/chat/completions"; | |
const MAX_TOKENS = 1500; | |
const TEMPERATURE = 0.5; | |
const SYSTEM_PROMPT = 'Act as assistant'; | |
const MESSAGES = ["hello", "hi!", "how are you?"]; | |
async function openAICompletion(msg) { | |
const options = { | |
method: "POST", | |
headers: { |
const path = require('path'); | |
const webpack = require('webpack'); | |
const VueLoaderPlugin = require('vue-loader/dist/plugin').default; | |
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
const ManifestPlugin = require('webpack-manifest-plugin'); | |
const isProd = process.env.NODE_ENV === 'production'; | |
const resolvePath = (...args) => path.resolve(path.join(__dirname, ...args)); |
<?php | |
class DateFixer { | |
public function fix(string $date): string { | |
$time = new DateTime($date); | |
$time->modify('+3 days'); | |
return $time->format('Y-m-d'); | |
} | |
} |
const amqp = require('amqplib'); | |
const uuid = require('uuid') | |
const CONSUMER_TAG = uuid.v4(); | |
const QUEUE_NAME = 'my_queue' | |
async function main() { | |
const conn = await amqp.connect('amqp://guest:guest@localhost:5672/%2F'); | |
const channel = await conn.createChannel(); | |
await channel.assertQueue(QUEUE_NAME); |
⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,
backup luks partition | |
1. Boot clonezilla | |
2. Drop into the command line | |
3. open the encrypted external drive partition | |
cryptsetup luksOpen /dev/sda3 backup |
Two files:
/etc/usb_modeswitch.d/rtl8821cu
/usr/share/usb_modeswitch/0bda:1a2b
TargetVendor=0x0bda
TargetProduct=0x1a2b
StandardEject=1
Adapted from caddy systemd Service Unit
The provided file should work with systemd version 219 or later. It might work with earlier versions.
The easiest way to check your systemd version is to run systemctl --version
.
We will assume the following:
#!/usr/bin/env bash | |
# | |
# Usage: dev_signed_cert.sh HOSTNAME | |
# | |
# Creates a CA cert and then generates an SSL certificate signed by that CA for the | |
# given hostname. | |
# | |
# After running this, add the generated dev_cert_ca.cert.pem to the trusted root | |
# authorities in your browser / client system. | |
# |