Skip to content

Instantly share code, notes, and snippets.

@jamesrr39
jamesrr39 / main.go
Last active January 5, 2024 10:47
convience functions for setting up Openapi-backend endpoints in Go
package main
import (
"context"
"fmt"
"net/http"
"time"
"github.com/go-chi/chi/middleware"
"github.com/go-chi/chi/v5"
@jamesrr39
jamesrr39 / vite-preact-ts.md
Last active October 3, 2023 21:21
Project scaffolding

Create and run project

Start off by using the yarn create command:

yarn create vite my-project --template preact-ts
cd my-project

Switch off telemetry (optional)

yarn config set enableTelemetry 0
@jamesrr39
jamesrr39 / server.go
Created November 17, 2022 21:49
Go HTTPS server example
package main
import (
"net/http"
"fmt"
)
/*
@jamesrr39
jamesrr39 / reflect-main.go
Created April 26, 2022 15:11
Go - reflection example
package main
import (
"fmt"
"reflect"
)
type Date struct {
Day int
Month int
@jamesrr39
jamesrr39 / tmux-cheatsheet.markdown
Created March 10, 2020 17:15 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jamesrr39
jamesrr39 / tsconfig.json
Created September 3, 2019 16:46
Tsconfig: bundle tool-free configuration, for use with es6 import style
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": ["node_modules/*"]
},
cd /tmp
wget http://rsync.samba.org/ftp/rsync/src/rsync-3.1.1.tar.gz -O - | tar xz
cd *rsync*
./configure
make
sudo make install
make clean
@jamesrr39
jamesrr39 / x (GUI) applications as another user.md
Created March 15, 2016 16:09
Running GUI applications as another user

For running GUI applications as another user

otheruser=<username>
xhost +SI:localuser:$otheruser
su $otheruser
...
@jamesrr39
jamesrr39 / tmux.md
Created March 15, 2016 13:00 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@jamesrr39
jamesrr39 / ssh-key-transfer.sh
Created March 5, 2016 18:03
Transferring an SSH public key
# transfer your public key to another computer
# variables that need changing marked with <>
public_key_path="<./ssh/machine-2/id_rsa.pub>"
remote_username="<james>"
remote_hostname="<192.168.x.x>"
key=$(cat $public_key_path) && \
ssh $remote_username@$remote_hostname "echo $key >> ~/.ssh/authorized_keys"