sh install-docker.sh- log out
- log back in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| LOCATION=${HCLOUD_LOCATION:-nbg1-dc3} | |
| if [ -z "$HCLOUD_TOKEN" ]; then | |
| echo "You need to set HCLOUD_TOKEN to an Hetzner API token!"; | |
| exit 1 | |
| fi | |
| if [ -z "$SSH_KEY" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Specify the shell | |
| SHELL := bash | |
| # Site URL | |
| OLD_URL = https://domain.test | |
| NEW_URL = https://www.domain.com | |
| # Commands to execute | |
| execute: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Installs NixOS on a Hetzner Cloud CX51 server, wiping the server. | |
| # | |
| # This is for a specific server configuration; adjust where needed. | |
| # | |
| # Prerequisites: | |
| # * Update the script to adjust SSH pubkeys, hostname, NixOS version etc. | |
| # | |
| # Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ask for the user password | |
| # Script only works if sudo caches the password for a few minutes | |
| sudo true | |
| # Install kernel extra's to enable docker aufs support | |
| # sudo apt-get -y install linux-image-extra-$(uname -r) | |
| # Add Docker PPA and install latest version | |
| # sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
| # sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Cleanup docker files: untagged containers and images. | |
| # | |
| # Use `docker-cleanup -n` for a dry run to see what would be deleted. | |
| untagged_containers() { | |
| # Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1. | |
| # NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6). | |
| # Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470 | |
| docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}' |
Based on: https://gist.github.com/kevin-smets/8568070
This gist outlines the steps needed to setup zsh, ohmyzsh and the powerlevel10k theme, available for anyone to follow.
-
Setup required dependencies
# update packages sudo apt update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use client"; | |
| import { useUpload } from "@/hooks/useUpload"; | |
| import { getSupabaseBrowserClient } from "@midday/supabase/browser-client"; | |
| import { useDropzone } from "react-dropzone"; | |
| export function Attachments({ id }) { | |
| const supabase = getSupabaseBrowserClient(); | |
| const [files, setFiles] = useState<Attachment[]>([]); | |
| const { isLoading, uploadFile } = useUpload(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { SupabaseClient } from "@supabase/auth-helpers-nextjs"; | |
| type UploadParams = { | |
| file: File; | |
| path: string; | |
| }; | |
| export async function upload( | |
| client: SupabaseClient, | |
| { file, path }: UploadParams, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { getSupabaseBrowserClient } from "@midday/supabase/browser-client"; | |
| import { getUserDetails } from "@midday/supabase/queries"; | |
| import { upload } from "@midday/supabase/storage"; | |
| import { useState } from "react"; | |
| export function useUpload() { | |
| const supabase = getSupabaseBrowserClient(); | |
| const [isLoading, setLoading] = useState(false); | |
| const uploadFile = async ({ bucketName, file, path }) => { |