Skip to content

Instantly share code, notes, and snippets.

View lpcvoid's full-sized avatar
💭
gcc is love, gcc is life

Marc lpcvoid

💭
gcc is love, gcc is life
View GitHub Profile
@lpcvoid
lpcvoid / safert12.txt
Last active November 10, 2019 13:17
Making the KSGER T12 soldering iron saf(er) to use
I recently bought a KSGER T12 iron due to its good reviews. The PCB itself is already pretty good, but I did two things additionally.
#Adding a ground connection to the case
If using a connector with ground capabilities (which should be standard for metal cased and not double insulated devices such as this), the device grounds the tip for ESD safety. The case is not grounded though, so I recommend a small modification.
#Increase isolation distance between heatsink and trace
As title suggests, I cut away a small part of the heatsink for the mosfet, so there's a larger distance to the live trace.
@lpcvoid
lpcvoid / http.hpp
Created December 26, 2022 14:16
simple http response parser
#pragma once
namespace netlib::http {
using http_header_entry = std::pair<std::string, std::string>;
using http_headers = std::vector<http_header_entry>;
struct http_response {
http_headers headers;
uint32_t response_code;
struct IntConverter {
template <typename T>
static inline std::array<uint8_t, sizeof(T)> to_array(T integer, std::endian e) {
std::array<uint8_t, sizeof(T)> result{0};
// this is a bit old and dirty maybe, but it will do
if (e == std::endian::little) {
for (uint32_t i = 0; i < sizeof(T); ++i) {
result[i] = static_cast<uint8_t>(integer >> (i * 8));
}
} else {