Skip to content

Instantly share code, notes, and snippets.

View domeniko-gentner's full-sized avatar

Domeniko Gentner domeniko-gentner

View GitHub Profile
@domeniko-gentner
domeniko-gentner / update_gitea.py
Last active February 26, 2022 17:51
Updating gitea automatically
#!/usr/bin/env python3
from requests import get
from requests import exceptions
from subprocess import run
def fetch_newest_gitea():
# change prefix as needed
GITEA_INSTALL = "/usr/local/bin/gitea"
@domeniko-gentner
domeniko-gentner / lima-dyndns.py
Last active October 16, 2023 20:14
Lima City API DynDNS
#!/usr/bin/env python3
import requests
import json
import sys
import datetime
# Updates Lima City DNS with v4 and v6
# Expects the file with all the secrets in /etc/.dyndns_secrets.json
#
# {
#!/usr/bin/env bash
### 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
@domeniko-gentner
domeniko-gentner / Color.cpp
Last active May 29, 2019 16:42
HTML color to std::byte
#include <iostream>
#include <cstddef>
#include <algorithm>
#include <string>
#include <exception>
struct Color{
Color(const std::string& html_col)
{
if (html_col.length() < 9){
@domeniko-gentner
domeniko-gentner / mixed
Created February 25, 2019 19:36
Console Input in HTML
#game-input-span {
position: absolute;
display: block;
font-family: 'Ubuntu Mono', monospace;
font-size: 18px;
color: #2ECC40;
}
#game-input {
background-color: black;
@domeniko-gentner
domeniko-gentner / WinMain.cpp
Created June 8, 2018 19:55
Cross platform main/WinMain combo
//-----------------------------------------------------------------
int main(int argc, char** argv)
//-----------------------------------------------------------------
{
// Continue as usual...
}
#ifdef _WINDOWS
#include "Windows.h"