Skip to content

Instantly share code, notes, and snippets.

@4ydx
4ydx / recvRawEth.c
Created February 1, 2024 00:38 — forked from austinmarton/recvRawEth.c
Receive raw Ethernet frames in Linux
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/ip.h>
@4ydx
4ydx / main.rs
Created June 18, 2023 01:05 — forked from fortruce/main.rs
Simple TCP Echo Server in Rust
use std::net::{TcpListener, TcpStream};
use std::thread;
use std::io::Read;
use std::io::Write;
fn handle_client(mut stream: TcpStream) {
// read 20 bytes at a time from stream echoing back to stream
loop {
let mut read = [0; 1028];
match stream.read(&mut read) {
@4ydx
4ydx / proxy_copy.go
Created May 25, 2023 07:53 — forked from jbardin/proxy_copy.go
Go TCP Proxy pattern
package proxy
import (
"io"
"log"
"net"
)
func Proxy(srvConn, cliConn *net.TCPConn) {
// channels to wait on the close event for each connection
@4ydx
4ydx / HttpProxy.go
Created May 25, 2023 07:21 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@4ydx
4ydx / golang-tls.md
Created May 25, 2023 06:34 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@4ydx
4ydx / goGetPrivate.md
Created December 26, 2022 09:09 — forked from StevenACoffman/goGetPrivate.md
How to `go get` private repos using SSH key auth instead of password auth.

Set GOPRIVATE to match your github organization

Cloning the repo using one of the below techniques should correctly but you may still getting an unrecognized import error.

As it stands for Go v1.13, I found in the doc that we should use the GOPRIVATE variable like so:

GOPRIVATE=github.com/ORGANISATION_OR_USER_NAME go get -u -f github.com/ORGANISATION_OR_USER_NAME/REPO_NAME

The 'go env -w' command (see 'go help env') can be used to set these variables for future go command invocations.

How to go get private repos using SSH key auth instead of password auth.

@4ydx
4ydx / main.go
Created February 13, 2019 06:50 — forked from lloeki/main.go
Using GopherJS and Electron together
// Electron's quick start sample, naively ported to Go
// https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md
//
// go get -u gopherjs
// gopherjs build main.go
// electron $(pwd)
package main
import (
@4ydx
4ydx / 00_blot6.md
Created March 17, 2018 09:49 — forked from keijiro/00_blot6.md
KodeLife fragment shader sketch

gif

@4ydx
4ydx / 00_blot4.md
Created March 17, 2018 09:49 — forked from keijiro/00_blot4.md
KodeLife fragment shader sketch

gif

@4ydx
4ydx / 00_blot7.md
Created March 17, 2018 09:48 — forked from keijiro/00_blot7.md
KodeLife fragment shader sketch

gif