Skip to content

Instantly share code, notes, and snippets.

View evan-sm's full-sized avatar
🌊

Ivan Smyshlyaev evan-sm

🌊
View GitHub Profile
func TestRouter(t *testing.T) {
used := ""
mw1 := func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
used += "1"
next.ServeHTTP(w, r)
})
}
@enjikaka
enjikaka / instructions.md
Last active April 29, 2025 20:23
Installing Proxmox on Raspberry Pi 4 and 5 (Pimox)

Installing Proxmox on Raspberry Pi 4 and 5

With these steps I managed to get Pimox on my Raspberry Pi 4 and 5 in february 2024.

Step 1 - Flashing the OS

Install "RPi OS Lite 64-bit" with Raspberry Pi Imager. It's listed under "Raspberry Pi OS (Other)"

@candlerb
candlerb / go-project-layout.md
Last active October 1, 2024 08:33
Suggestions for go project layout

If someone asked me the question "what layout should I use for my Go code repository?", I'd start by asking back "what are you building: an executable, or a library?"

Single executable

Stage 1: single source file

Create a directory named however you want your final executable to be called (e.g. "mycommand"), change into that directory, and create the following files:

@andrewmkano
andrewmkano / contact_Initial.go
Created February 20, 2021 21:03
Prerequisite queries for the multi-insert example
package models
import (
"database/sql"
"fmt"
"strings"
"github.com/pkg/errors"
)
@Herz3h
Herz3h / install.md
Last active June 14, 2022 18:18
Locales alpine 3.9

Copy locale.md file below into same directory as your Dockerfile

FROM alpine:3.9

# Install language pack
RUN apk --no-cache add ca-certificates wget && \
    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-2.25-r0.apk && \
@jtbonhomme
jtbonhomme / hasMany.go
Created May 22, 2018 11:11
Gorm example of foreign key definition for a hasMany relation
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
)
// Customer ...
type Customer struct {
@dopey
dopey / main.go
Last active April 22, 2025 12:17 — forked from denisbrodbeck/main.go
How to generate secure random strings in golang with crypto/rand.
package main
import (
"crypto/rand"
"encoding/base64"
"fmt"
"io"
"math/big"
)

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@andrewmilson
andrewmilson / file-upload-multipart.go
Last active April 14, 2025 12:54
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@hvrauhal
hvrauhal / convert-to-vp9-ogg-webm-and-normalize-audio.sh
Last active April 17, 2016 17:13
This script uses ffmpeg to convert video to vpx9 and audio to vorbis, then sox to normalize audio, and finally ffmpeg to bundle the streams back together
#!/bin/zsh
# Install needed tools:
# brew install sox --with-libvorbis
# brew install ffmpeg --with-libvpx --with-libvorbis --with-opus --with-faac
set -e
FILENAME=$1
echo "Converting $FILENAME to webm + ogg with normalized audio"
ffmpeg -i ${FILENAME} -c:a libvorbis -vn ${FILENAME}_audio_orig.ogg
ffmpeg -i ${FILENAME} -c:v libvpx-vp9 -crf 50 -b:v 0 -vf scale=840:-1 -g 50 -an ${FILENAME}_video_orig.webm