Skip to content

Instantly share code, notes, and snippets.

View 9bany's full-sized avatar
🏠
Working from home

Bany 9bany

🏠
Working from home
View GitHub Profile
FROM golang:1.23.0-bookworm AS build
ARG upx_version=4.2.4
RUN apt-get update && apt-get install -y --no-install-recommends xz-utils && \
curl -Ls https://github.com/upx/upx/releases/download/v${upx_version}/upx-${upx_version}-amd64_linux.tar.xz -o - | tar xvJf - -C /tmp && \
cp /tmp/upx-${upx_version}-amd64_linux/upx /usr/local/bin/ && \
chmod +x /usr/local/bin/upx && \
apt-get remove -y xz-utils && \
rm -rf /var/lib/apt/lists/*
@9bany
9bany / readme.md
Created March 14, 2023 08:48
Resize tablespace in oracle

1. Run a query similar to the following to identify if the tablespace is:

  • Permanent, undo, or temporary
  • Smallfile or bigfile
SQL> SELECT TABLESPACE_NAME, CONTENTS, BIGFILE FROM DBA_TABLESPACES;

2. Run a query similar to the following to check if the autoextend feature is turned on, the current size of the datafile, and the maximum configured limit:

For Permanent and undo tablespaces:

@9bany
9bany / readme.md
Created January 9, 2023 09:02
regex
  1. Name - allow vietnamese characters
  • ^[a-z0-9A-Z_\x{00C0}-\x{00FF}\x{1EA0}-\x{1EFF} ,.'-]{3,35}+$
@9bany
9bany / run.sh
Created November 4, 2022 04:23
Docker command run postgresql conatiner
docker run --name postgres-latest -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -d postgres
docker exec -it postgres-latest createdb --username=root --owner=root <db_name>
@9bany
9bany / docker-compose.yml
Created October 18, 2022 06:06
Docker compose for kafka
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:6.2.1
hostname: zookeeper
container_name: zookeeper
ports:
- "2181:2181"
environment:
@9bany
9bany / main.go
Created July 30, 2022 08:45 — forked from montanaflynn/main.go
Gin request timeout middleware and handler
package main
import (
"context"
"log"
"net/http"
"time"
"github.com/gin-gonic/gin"
)
@9bany
9bany / main.go
Created July 30, 2022 04:49
Context with timeout in Go
package main
import (
"context"
"fmt"
"math/rand"
"os"
"os/signal"
"syscall"
"time"
@9bany
9bany / go-bench.sh
Created July 28, 2022 09:05
Generate benchmark files in a Git repository.
#!/bin/bash
#
# Generate benchmark files in a Git repository.
#
# Usage: TIMES=1 go-bench [prefix]
#
# Number of times to run the benchmark; useful for benchstat.
TIMES=${TIMES:-1}
@9bany
9bany / hash_password_salt.go
Created July 25, 2022 01:37
Hash password with salt
import (
"crypto/rand"
"fmt"
"io"
"log"
"code.google.com/p/go.crypto/scrypt"
)
const (
@9bany
9bany / jwt_maker.go
Created July 20, 2022 02:30
Token maker in go
package token
import (
"errors"
"fmt"
"time"
"github.com/dgrijalva/jwt-go"
)