Skip to content

Instantly share code, notes, and snippets.

View avary's full-sized avatar

Abdulhafiz KAŞGARLI avary

View GitHub Profile
@avary
avary / android-backup-apk-and-datas.md
Created April 12, 2024 23:28 — forked from AnatomicJC/android-backup-apk-and-datas.md
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@avary
avary / main.go
Created April 2, 2024 09:33 — forked from buroz/main.go
Golang SOAP Request Example
package main
import (
"bytes"
"crypto/tls"
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
"strings"
@avary
avary / pagination.js
Created March 12, 2024 08:44 — forked from arturo-source/pagination.js
Simple pagination JS script. Paginator class is 100 lines of JavaScript code to paste into your project and easily handle an array of elements.
class Paginator {
constructor({
elements,
cellsPerRow = 5,
rowsPerPage = 4,
renderFunc,
prevBtn,
nextBtn,
firstBtn,
lastBtn,
@avary
avary / main.go
Created March 12, 2024 08:37 — forked from mcheviron/main.go
Golang array map, concurrency problem
package main
import (
"fmt"
"runtime"
"sync"
"time"
)
func Map[T1, T2 any](arr []T1, f func(item T1, index int) T2) []T2 {
@avary
avary / update-golang.md
Created March 1, 2024 06:23 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@avary
avary / folder_structure.md
Created February 12, 2024 06:17 — forked from ayoubzulfiqar/folder_structure.md
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files
@avary
avary / example.go
Created January 25, 2024 09:11 — forked from nd2408/example.go
fsnotify wrapper
logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
AddSource: false,
Level: slog.LevelDebug,
}))
slog.SetDefault(logger)
watcher, err := watcher.New(logger)
defer watcher.Shutdown()
err = watcher.Watch("/home/user", func(e watcher.Event) error {
@avary
avary / benchmarks_test.go
Created January 9, 2024 06:08 — forked from alaindet/benchmarks_test.go
Go slice mapping concurrently
package main
import "testing"
func BenchmarkConcMap100(b *testing.B) {
b.StopTimer()
input := createRange(100)
output := make([]int, 0, len(input))
b.StartTimer()
@avary
avary / CustomResponseWriter.go
Created January 9, 2024 05:51 — forked from prakashpandey/CustomResponseWriter.go
Implement custom http.ResponseWriter in golang
package main
import (
"fmt"
"net/http"
)
type CustomResponseWriter struct {
body []byte
statusCode int
@avary
avary / gin-secure-https.go
Created December 13, 2023 09:30 — forked from kenng/gin-secure-https.go
redirect gin http to https using unrolled/secure
// gin will throw following for the first time due to secure initiate a http.Redirect but gin is unaware of it
// [GIN-debug] [WARNING] Headers were already written. Wanted to override status code 301 with 200
package main
import (
"github.com/gin-gonic/gin"
"github.com/unrolled/secure"
)