Skip to content

Instantly share code, notes, and snippets.

View smjure's full-sized avatar

smjure

View GitHub Profile
package main
import (
"fmt"
"os"
"path/filepath"
"github.com/go-fsnotify/fsnotify"
)
@smjure
smjure / syncthing-setup-exclusively-with-CLI.md
Last active November 22, 2023 09:12 — forked from Jonny-exe/syncthing-setup-exclusively-with-CLI.md
syncthing setup exclusively with CLI

GCE gcloud command: setup ssh key and connect to the desired VM instance

  1. create ssh key:https://cloud.google.com/compute/docs/connect/create-ssh-keys
  2. add pub key to VM: https://cloud.google.com/compute/docs/connect/add-ssh-keys#os-login
  3. ssh connect to VM: https://cloud.google.com/compute/docs/connect/standard-ssh

Syncthing setup on Linux

Syncthing setup: https://www.linuxbabe.com/ubuntu/install-syncthing-ubuntu-desktop-server

START / STOP Syncthing Service

This is useful for automated bash scripts.

@smjure
smjure / humanize-duration.go
Created November 30, 2022 19:51 — forked from harshavardhana/humanize-duration.go
humanizeDuration humanizes time.Duration output to a meaningful value - golang's default ``time.Duration`` output is badly formatted and unreadable.
package main
import (
"fmt"
"math"
"time"
)
// humanizeDuration humanizes time.Duration output to a meaningful value,
// golang's default ``time.Duration`` output is badly formatted and unreadable.

Screen Quick Reference

Basic

Description Command
Detach from screen keybinding ctrl+a d
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x