Skip to content

Instantly share code, notes, and snippets.

View NHAS's full-sized avatar

NHAS

View GitHub Profile
@lachlan2k
lachlan2k / ilo-smtp-webhook-bridge.py
Created November 7, 2021 01:27
Relay iLO4 AlertMail to a Discord Webhook with a simple SMTP server
import email
import asyncio
import requests
import quopri
from aiosmtpd.controller import Controller
from email.policy import default as default_policy
# Closest thing to auth it supports, just use a random long string as the recipient
KEY = '<snip>@foobar.com'
WEBHOOK_URL = 'https://discord.com/api/webhooks/<snip>'
@SCP002
SCP002 / write_to_stdin_windows.go
Last active March 15, 2022 22:02
Golang: Write a message to the current (see comments for a method for any console) console's input on Windows.
// Used in https://github.com/SCP002/terminator.
// For POSIX, see: https://gist.github.com/SCP002/c7c3bf4aafd3e32e0dc0aa65dda2bf14.
package main
import (
"errors"
"os"
"unsafe"
@UserExistsError
UserExistsError / winpty.go
Created September 5, 2020 18:14
Windows Pseudo Console (ConPTY) in Golang
package main
// Windows pty example
// https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
import (
"io"
"os"
"fmt"
"log"
@chrisoldwood
chrisoldwood / autounattend.xml
Created November 25, 2019 16:12
Example Packer configuration files for creating a Windows 10 VM on QEMU/KVM/libvirt.
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<SystemLocale>en-US</SystemLocale>
@hallazzang
hallazzang / main.go
Last active August 6, 2024 23:01
[go] (Windows) ensure all child processes are killed when main program exits
package main
import (
"os/exec"
"unsafe"
"golang.org/x/sys/windows"
)
// We use this struct to retreive process handle(which is unexported)
@shaneutt
shaneutt / LICENSE
Last active November 14, 2024 02:16
Golang: Demonstrate creating a CA Certificate, and Creating and Signing Certs with the CA
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@fnky
fnky / ANSI.md
Last active November 18, 2024 06:36
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@NaniteFactory
NaniteFactory / dllmain.go
Last active March 15, 2024 16:35
An implementation example of DllMain() entrypoint with Golang. $ go build --buildmode=c-shared -o my.dll && rundll32.exe my.dll Test
package main
//#include "dllmain.h"
import "C"
@MawKKe
MawKKe / cryptsetup-with-luks2-and-integrity-demo.sh
Last active November 13, 2024 18:33
dm-crypt + dm-integrity + dm-raid = awesome!
#!/usr/bin/env bash
#
# Author: Markus (MawKKe) [email protected]
# Date: 2018-03-19
#
#
# What?
#
# Linux dm-crypt + dm-integrity + dm-raid (RAID1)
#
@rivo
rivo / postgres.go
Last active July 7, 2024 14:28
A demo Go application (a PostgreSQL database browser) highlighting the use of the rivo/tview package. See https://github.com/rivo/tview/wiki/Postgres
package main
import (
"database/sql"
"fmt"
"net/url"
"os"
"reflect"
"regexp"
"strconv"