Skip to content

Instantly share code, notes, and snippets.

View aaangeletakis's full-sized avatar
🌴
On vacation

aaangeletakis

🌴
On vacation
View GitHub Profile
@easyaspi314
easyaspi314 / README.md
Last active May 30, 2021 17:23
C style void pointer/malloc wrapper for C++

C Style Malloc in C aka Void Pointers

One of the most annoying things about C++ is the incompatibility with C's void * conversion. In C, void * can be cast implicitly to any pointer type, but C++ needs an explicit cast.

Most C code is valid C++ code, but the most common issue is malloc, which returns void *.

For example, this is valid C code, but not valid C++ code:

struct Foo *x = malloc(sizeof(struct Foo));
@mattia-beta
mattia-beta / ddos.conf
Last active April 27, 2024 22:00
IPtables DDoS Protection for VPS
### 1: Drop invalid packets ###
/sbin/iptables -t mangle -A PREROUTING -m conntrack --ctstate INVALID -j DROP
### 2: Drop TCP packets that are new and are not SYN ###
/sbin/iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
### 3: Drop SYN packets with suspicious MSS value ###
/sbin/iptables -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
### 4: Block packets with bogus TCP flags ###
@0liver
0liver / GoogleAnalyticsApi.cs
Last active March 24, 2023 09:34
C# wrapper around the Google Analytics Measurement Protocol API
/* based on the docs at: https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide */
/*
* LICENSE: MIT
* AUTOHR: oliver@teamaton.com
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;