Skip to content

Instantly share code, notes, and snippets.

@arnu515
arnu515 / README.md
Last active January 23, 2024 01:01
Streaming SSR with Bun + Elysia and TailwindCSS

Streaming SSR with Bun + Elysia and TailwindCSS

This is a simple example on how to stream HTML with Elysia in Bun with TailwindCSS (through twind).

This uses the latest @twind/core API.

Please suggest any speed improvements in the comments 🙏

TODO

@arnu515
arnu515 / implementation.ts
Last active October 23, 2023 09:01
Amazon S3 Presigned post
// ON THE SERVER
import { generatePresignedPost } from "./s3";
const {url, fields} = await generatePresignedPost(...); // fill with your own parameters.
// send the above url, fields to the Client.
// ON THE CLIENT/BROWSER
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true
VI_MODE_SET_CURSOR=true
MODE_INDICATOR="%F{red}N%f"
INSERT_MODE_INDICATOR="%F{green}I%f"
@arnu515
arnu515 / README.md
Last active July 3, 2023 17:05
Countries with 2letter and 3letter iso 3166 codes with emojis and flag url
@arnu515
arnu515 / README.md
Created November 3, 2022 01:06
Extensions to mimetypes and mimetypes to extensions json files

If you want to regenerate this file, you can use this REPL. Just run the repl and it will create a file called mimetypes_to_extensions.json and extensions_to_mimetypes.json.

The data for this is provided by Apache. Leave a comment if it is outdated, and I'll update it.

@arnu515
arnu515 / countries.csv
Last active October 30, 2022 04:21
Countries with Calling Code - CSV and JSON
name calling_code alpha2 alpha3
Afghanistan 93 AF AFG
Albania 355 AL ALB
Algeria 213 DZ DZA
American Samoa 1-684 AS ASM
Andorra 376 AD AND
Angola 244 AO AGO
Anguilla 1-264 AI AIA
Antarctica 672 AQ ATA
Antigua and Barbuda 1-268 AG ATG

DigitalOcean Domains Dynamic DNS

Automatically updates a domain (registered with DigitalOcean)'s record with the current IP of the machine. Ideal for home-labs with dynamic IPs who want to avoid services like NoIP or can't use cloudflare domains.

Designed for Linux

How to use

Requires: Python 3.6.9 or later, requests library installed.

@arnu515
arnu515 / SortArray.java
Created June 21, 2021 09:37
Bubble, selection and insertion sort implemented in java
import java.util.Scanner;
import java.util.Random;
public class SortArray {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("1. Bubble sort\n2. Selection sort\n3. Insertion sort\n");
System.out.println("Enter integer:");
int choice = s.nextInt();
@arnu515
arnu515 / .eslintrc.cjs
Created June 14, 2021 14:00
.eslintrc.cjs and .prettierrc
module.exports = {
root: true,
extends: ["eslint:recommended", "prettier"],
ignorePatterns: ["*.cjs"],
rules: {},
env: {
es2017: true,
node: true
}
};
@arnu515
arnu515 / App.svelte
Last active April 30, 2021 04:23
Dev.to Implement Passwordless sign-in to your apps
<script lang="ts">
import Auth from "./lib/components/Auth.svelte";
import Code from "./lib/components/Code.svelte";
let sentLink = false;
let token = localStorage.getItem("token");
async function getUser() {
if (!token) return;
try {