Skip to content

Instantly share code, notes, and snippets.

@noobnooc
noobnooc / cloudflare-worker-proxy.js
Last active May 10, 2025 17:15
cloudflare-worker-proxy
// Website you intended to retrieve for users.
const upstream = 'api.openai.com'
// Custom pathname for the upstream website.
const upstream_path = '/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = upstream
// Countries and regions where you wish to suspend your service.
@sannajammeh
sannajammeh / Parent.tsx
Last active May 9, 2025 01:16
Next.js Loading HLS Video's the performant way.
import dynamic from "next/dynamic";
import Head from "next/head";
import React, { Suspense, useEffect, useRef, useState } from "react";
const HLSPlayer = dynamic(() => import("@components/HLSPlayer"), {
suspense: true,
});
const Parent = () => {
const [video, setVideo] = useState<HTMLVideoElement | null>(null); // use callback state instead of ref due to hydration of SSR stream
@rougier
rougier / clean.el
Created May 10, 2020 02:43
A very minimal but elegant emacs configuration file
(require 'org)
(setq-default indent-tabs-mode nil)
(setq org-display-inline-images t)
(setq org-redisplay-inline-images t)
(setq org-startup-with-inline-images "inlineimages")
(setq default-frame-alist
(append (list '(width . 72) '(height . 40))))
@joshuadanpeterson
joshuadanpeterson / guitar_tabs_template.txt
Last active April 6, 2025 04:01
[Guitar Tabs Template] Plaintext guitar tab template #music #txt
# Guitar Tabs Template
# Created by: Ultimate Guitar
# Source URL: https://www.ultimate-guitar.com/lessons/for_beginners/guitar_tabs_template.html
-----------------------------------------------------------------
SONG NAME - Band Name
-----------------------------------------------------------------
Tabbed by:
Email:
@yurikilian
yurikilian / ApiApplication.java
Last active March 17, 2023 04:38
Soft Delete Mongo Repository
import br.com.radharsomeluz.inventory.configuration.SoftDeletionMongoRepository;
import br.com.radharsomeluz.inventory.configuration.SoftDeletionRepositoryFactoryBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
@EnableMongoRepositories(
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 16, 2025 13:07
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@nickyfoto
nickyfoto / video_sub_dl.sh
Last active October 20, 2023 09:31
Download video and its subtitle and merge subtitle to it.
# list available subtitles
# https://superuser.com/questions/927523/how-to-download-only-subtitles-of-videos-using-youtube-dl
youtube-dl --list-subs https://www.youtube.com/watch?v=lmWh9jV_1ac
# download a particular subtitle
youtube-dl --write-sub --sub-lang zh-CN --skip-download https://www.youtube.com/watch\?v\=lmWh9jV_1ac
# download auto generated sub
youtube-dl --write-auto-sub --sub-lang zh-CN --skip-download https://www.youtube.com/watch\?v\=lmWh9jV_1ac
@jakub-g
jakub-g / async-defer-module.md
Last active May 14, 2025 13:50
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@zikes
zikes / .zshrc
Last active November 14, 2022 03:45
Using kube-ps1 with P9K
# Enable the kube-ps1 oh-my-zsh plugin
plugins = (
git
kube-ps1
)
# The output of the kube_ps1 function is text, so it can be used
# directly as a custom p9k segment
POWERLEVEL9K_CUSTOM_KUBE_PS1='kube_ps1'
@jreijn
jreijn / EntityResource.java
Created May 9, 2018 22:37
IntelliJ Live template for Spring REST TDD demo
package ${PACKAGE_NAME};
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Resource;
public class ${NAME} extends Resource<${ENTITY}> {
public ${NAME}(${ENTITY} content, Link... links) {
super(content, links);
}