Skip to content

Instantly share code, notes, and snippets.

track_keywords:
- keyword: "Keyword to watch 1"
enabled: true
- keyword: "Keyword to watch 2"
enabled: false
whole_word: true
flags: "no-reddit, no-posts"
##
# Builder
##
FROM node:20.10-alpine AS builder
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
@l4r-s
l4r-s / script.ts
Created October 13, 2024 15:18
Migrate Email Address to plunk.
###
# Run
# npx tsc script.ts
# node script.js
###
async function sendToPlunk(email: string, referer: string) {
const response = await fetch('https://api.useplunk.com/v1/track', {
method: 'POST',
headers: {
@l4r-s
l4r-s / buyButton.tsx
Created October 1, 2024 16:47
Next.js Component for exploding Confetti on Click!
'use client'
import { useRouter } from 'next/navigation';
import React from 'react';
import Confetti from 'react-dom-confetti';
const BuyButton = ({ url }: { url: string }) => {
const router = useRouter();
const [isExploding, setIsExploding] = React.useState(false);
@l4r-s
l4r-s / confetti.tsx
Last active October 14, 2026 02:03
Next.js Confetti Component - Add falling confetti animation to your Next.js app, just like the background on https://confettisaas.com. Perfect for celebratory events or adding a fun, festive touch to your website.
"use client";
import Confetti from "react-confetti";
import { useState, useEffect } from "react";
export default function ConfettiComponent() {
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
const [isSafari, setIsSafari] = useState(false);
useEffect(() => {
# /etc/rancher/k3s/config.yaml
token: <super secure token>
datastore-endpoint: "sqlite:///var/lib/rancher/k3s/server/db/k3s.db"
write-kubeconfig: /home/lars/.kube/config
write-kubeconfig-mode: 644
flannel-backend: wireguard-native
tls-san:
- server.dns.address.example.com
disable:
- servicelb
@l4r-s
l4r-s / postgres-backup-to-nextcloud.yml
Created August 30, 2024 23:28
Backup a postgresql DB to a Nextcloud instance
{{- if .Values.enable_backup }}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ .Release.Name }}-backup
namespace: {{ .Release.Namespace }}
spec:
schedule: "{{ .Values.backup_schedule }}"
successfulJobsHistoryLimit: 0
jobTemplate:
@l4r-s
l4r-s / page.tsx
Last active August 19, 2024 19:41
import { headers } from 'next/headers';
import { redirect } from 'next/navigation';
export default function Page({ searchParams }: { searchParams: { [key: string]: string } }) {
const reqHeaders = headers();
// get referrer from headers this is the url of the page that the user was on before they were redirected to this page
const referrer = reqHeaders.get('referer') || 'https://hilars.dev/v2e';
// get referrer from search params (?r=myreferrer), this overrides the referrer from headers if it exists