Skip to content

Instantly share code, notes, and snippets.

View lotusirous's full-sized avatar
💭
for { Learn() }

Kha Nguyen lotusirous

💭
for { Learn() }
View GitHub Profile
@lotusirous
lotusirous / goembed.go
Created May 17, 2021 07:06
Go embed read each file in a folder
package main
import (
"embed"
"fmt"
"log"
)
//go:embed ddl/*
var files embed.FS
package main
import (
"bufio"
"fmt"
"io"
"log"
"os/exec"
"strings"
)
@lotusirous
lotusirous / find_file_by_hash.go
Last active September 17, 2020 00:18
An example of finding apk file by its hash
package main
import (
"crypto/md5"
"flag"
"fmt"
"io"
"log"
"os"
"path/filepath"

VNC server on XFCE4

Create .vnc/xstartup

#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4
package main
import (
"encoding/json"
"fmt"
"os"
)
type Foo struct {
Object map[string]string `json:"obj"`
package main
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
)
// HandleDump returns an http.HandlerFunc that processes an http.Request
@lotusirous
lotusirous / sse.go
Created February 25, 2020 13:19
A sample server sent event with golang
package main
import (
"context"
"fmt"
"io"
"net/http"
"os"
"os/signal"
"syscall"
import (
"bytes"
"compress/flate"
"encoding/base64"
"encoding/hex"
"log"
)
func flateBase64(s string) (string, error) {
var b bytes.Buffer
package main
import (
"context"
"net/http"
"github.com/go-chi/chi"
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
)
print(u'\U0001d67a', u'\U0001d677', u'\U0001d670')