Skip to content

Instantly share code, notes, and snippets.

View romanitalian's full-sized avatar
🎯
Focusing

roman romadin romanitalian

🎯
Focusing
View GitHub Profile
@romanitalian
romanitalian / wp_make_new_site.sh
Last active January 29, 2024 09:47
BASH script to make new WP site: download and WP, configure and restart NGINX; install/make wordpress site by Bash script; wordpress install; wordpress configuration; wordpress initialisation
#!/bin/bash
# -------------------------------------------------
# Make site directory
# Download WP and install WP to site directory
# Set WP configuration
# Configure NGINX for new domain-name
# -------------------------------------------------
# apt-get update
@romanitalian
romanitalian / django_init.sh
Created June 19, 2021 18:34
make Django project from scratch (in one command).
#!/bin/bash
# README
# --------------------
# chmod u+x django_init.sh
# ./django_init.sh my-super-project.com main
# --------------------
SETTINGS_APP="core"
package main
import (
"strings"
"testing"
"time"
)
func timeIntToString(val int) string {
switch val {
// lout
log.Debugf("-------- $VAR$: %#v", $VAR$)$END$
// sout
fmt.Printf("------- rmn123 $VAR$: %+v\n", $VAR$)$END$
// fout
fmt.Println("$VAR$")
// ii
package main
import (
"log"
"net/http"
)
// go run main.go
//
// $ curl "http://127.0.0.1:8090"
go test -bench=. -benchmem
BenchmarkRedisSet-8 1526 802456 ns/op 249 B/op 9 allocs/op
BenchmarkRedisGet-8 1552 818410 ns/op 196 B/op 7 allocs/op
BenchmarkEtcdSet-8 80 27729002 ns/op 14010 B/op 124 allocs/op
BenchmarkEtcdGet-8 9590 125109 ns/op 7070 B/op 125 allocs/op
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/go-redis/redis"
clientv3 "go.etcd.io/etcd/client/v3"
package main
import (
"context"
"fmt"
"log"
"testing"
)
// go test -bench=. -benchmem
go mod tidy
go run main.go
# etcd is great
package main
import (
"fmt"
clientv3 "go.etcd.io/etcd/client/v3"
)
func NewEtcdClient() (*clientv3.Client, error) {
cl, err := clientv3.New(clientv3.Config{
Endpoints: []string{"localhost:2379"},