Skip to content

Instantly share code, notes, and snippets.

View NaniteFactory's full-sized avatar
😊
Hi

NaniteFactory

😊
Hi
View GitHub Profile
@NaniteFactory
NaniteFactory / memset.asm
Created June 13, 2018 07:08
memset() - fills a specified (ecx) amount of memory (at [edi]) with a given value (in eax).
lea edi,[ebp-000000CC]; 8D BD 34FFFFFF
mov ecx,00000033; B9 33000000
mov eax,CCCCCCCC; B8 CCCCCCCC
repe stosd; repeat until equal(zero flag 1) - store string dword of accumulator(eax)
@NaniteFactory
NaniteFactory / detect-jre.reg
Last active June 21, 2018 18:49
(EXAMPLE) Registry for legacy applications that cannot detect JRE version >= 1.9
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
"CurrentVersion"="1.8"
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8]
"JavaHome"="D:\\Program Files\\Java\\jre-10.0.1"
"RuntimeLib"="D:\\Program Files\\Java\\jre-10.0.1\\bin\\server\\jvm.dll"
@NaniteFactory
NaniteFactory / git-bash-here.reg
Created June 25, 2018 17:53
"Git Bash here" context menu item // Registry exports directly from the Windows installer.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell]
@="Git Ba&sh Here"
"Icon"="D:\\Program Files\\Git\\git-bash.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell\command]
@="\"D:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""
@NaniteFactory
NaniteFactory / io_reader_to_writer.go
Created July 15, 2018 12:50
From io.Reader to io.Writer
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
)
@NaniteFactory
NaniteFactory / from_json_to_map.go
Last active July 17, 2018 11:28
Parse & convert JSON into a map
package main
import (
"encoding/json"
"fmt"
)
func main() {
data := []byte(`{"sendMsg":{"user":"ANisus","msg":"Trying to send a message"},"say":"Hello"}`)
@NaniteFactory
NaniteFactory / get_string_in_between.go
Last active July 16, 2018 14:14
GetStringInBetween() with a bug fix
package main
import (
"fmt"
"strings"
)
func main() {
str := []byte("sdfsdffio jeo <!--foo wij ewie jo fwiejwoeifjwoeifjoweifjo --> weifj ow ejowifj woesdfsdffio jeo <!--bar wij ewie jo fwiejwo2222222222eifjwoeifjoweifjo --> weifj ow ejowifj woe<!--bars -->")
fmt.Println(GetStringInBetween(string(str), "<!--foo ", " -->"))
@NaniteFactory
NaniteFactory / hello_world_in_different_languages.go
Created July 29, 2018 11:32
"Hello, world." in 8 different languages for testers.
package main
import (
"fmt"
)
type HelloWorld struct {
Arabic string
English string
Greek string
@NaniteFactory
NaniteFactory / unescape_unicode_sequences_in_json.go
Created July 29, 2018 11:39
Converting escaped forms of unicode characters in JSON into unescaped UTF-8 characters.
package main
import (
"encoding/json"
"fmt"
"strconv"
"strings"
)
func _UnescapeUnicodeCharactersInJSON(_jsonRaw json.RawMessage) (json.RawMessage, error) {
@NaniteFactory
NaniteFactory / traverse_unmarshalled_json.go
Created August 5, 2018 09:18
Traverse / iterate over an unmarshalled JSON data in Golang.
package main
import (
"encoding/json"
"errors"
"fmt"
"io"
"os"
)
@NaniteFactory
NaniteFactory / messagebox.go
Last active April 24, 2024 17:58
Win32 API MessageBox() in Golang
import (
"syscall"
"unsafe"
)
// MessageBox of Win32 API.
func MessageBox(hwnd uintptr, caption, title string, flags uint) int {
ret, _, _ := syscall.NewLazyDLL("user32.dll").NewProc("MessageBoxW").Call(
uintptr(hwnd),
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(caption))),