Skip to content

Instantly share code, notes, and snippets.

View ptflp's full-sized avatar
🤟
Quality over quantity?

Petr Filippov ptflp

🤟
Quality over quantity?
View GitHub Profile
@ptflp
ptflp / dao.go
Created January 15, 2024 08:44
task3.1.1.4
package dao
import (
"context"
"database/sql"
"fmt"
"golang-course/test/dao/tabler"
"reflect"
"strings"
@ptflp
ptflp / main.go
Created August 29, 2023 10:33
Self hosted Gitlab user registrtation api
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
@ptflp
ptflp / prometheus.yml
Created March 3, 2023 21:02
Basic prometheus configuration
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
metrics_path: '/metrics'
static_configs:
version: '3.3'
services:
api:
container_name: ${APP_NAME}api
image: ${IMAGE}
env_file: .env
command: bash -c "cd ${REPOSITORY} && go mod tidy -compat=1.17 && go run ./cmd/api"
restart: always
volumes:
- ./:/go/src/${REPOSITORY}
@ptflp
ptflp / test.json
Last active April 1, 2024 08:24
test data for Kata students
[{"message":"Others pounce tomorrow little hardly.","uuid":"426f16dd-d044-4844-be5c-0571b9411db5","date":"2022-07-05"},{"message":"Failure his all comb them.","uuid":"7374257f-1ca0-441a-81ad-8bf5515c346f","date":"2020-06-27"},{"message":"Thai of totally irritably even.","uuid":"32d42389-58d2-4996-95da-62ad89db6412","date":"2022-01-26"},{"message":"Moreover nest of out where.","uuid":"79e515c8-10ba-414a-821a-64b255224ad6","date":"2022-02-25"},{"message":"Couple orchard ours Polish nice.","uuid":"2a7b5ea8-fe08-44c7-8257-645f043cb1cc","date":"2022-03-25"},{"message":"Chastise all then lately did.","uuid":"5658f589-9734-43c2-b693-5b315f4c5bc3","date":"2021-04-24"},{"message":"Was inside tonight wide at.","uuid":"88ff2f24-123d-4a8d-a45f-2e36dc3a5a27","date":"2021-03-15"},{"message":"Why far monthly tomorrow first.","uuid":"26d1e1e5-2802-445c-b337-b93e4f35b161","date":"2020-11-05"},{"message":"How were bathe nevertheless yours.","uuid":"d39b6650-0991-461f-91a5-0403181d3c4d","date":"2021-03-12"},{"message":"Then sit
@ptflp
ptflp / .gitlab-ci.yaml
Last active October 13, 2022 11:52
Kata Golang gitalb CI/CD
# This file is a template, and might need editing before it works on your project.
image: golang:latest
variables:
# Please edit to your GitLab project
REPO_NAME: gitlab.com/ptflp/go-kata
GIT_DEPTH: 10
stages:
- lint
@ptflp
ptflp / main.go
Created June 14, 2022 10:00
RLE Golang implementation
package main
import (
"fmt"
"strconv"
"strings"
)
func main() {
str := "aaaaaabbbbacccccaaabbbbbc"
@ptflp
ptflp / README.md
Last active May 27, 2022 05:25
git squash like automate tool

put to /usr/local/bin/git-squash

execute in bash chmod +x /usr/local/bin/git-squash

use git squash

@ptflp
ptflp / main.go
Last active May 24, 2022 15:24
34 lines Hello, world on golang
package main
import (
"fmt"
"reflect"
"regexp"
"strconv"
"unsafe"
)
@ptflp
ptflp / struct_to_bytes.go
Created May 9, 2022 15:59 — forked from SteveBate/struct_to_bytes.go
Example of converting a struct to a byte slice, compressing with gzip, and saving to file followed by the reverse process back to a struct
package main
import (
"bytes"
"compress/gzip"
"encoding/gob"
"fmt"
"io/ioutil"
"log"
"os"