Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Instantly share code, notes, and snippets.

View utoni's full-sized avatar
🏳️‍🌈
❤️ 🇮🇱

Toni utoni

🏳️‍🌈
❤️ 🇮🇱
View GitHub Profile
@utoni
utoni / async-task-future-then.cpp
Created November 27, 2024 18:26
boost: asio + futures
// clang++ -Wall -Wextra -g3 async-task-future-then.cpp -o async-task-future-then -lboost_thread
#define BOOST_THREAD_PROVIDES_FUTURE
#define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
#include <boost/asio/deadline_timer.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/strand.hpp>
#include <boost/format.hpp>
#include <boost/random/mersenne_twister.hpp>
@utoni
utoni / github-stars-and-forks.go
Created September 10, 2023 20:51
User Repositories: List stars and forks
// Install deps with: go get -u -v github.com/google/go-github github.com/ProtonMail/go-crypto/openpgp github.com/google/go-querystring/query
package main
import (
"context"
"fmt"
"log"
"os"
@utoni
utoni / hostapd-sta-notify.py
Last active September 11, 2022 09:50
hostapd station notification
#!/usr/bin/env python3
import csv
from email.mime.text import MIMEText
import fcntl
import json
import smtplib
import socket
import sys
import time
@utoni
utoni / generate-tls-ca.sh
Created June 7, 2022 00:56
GnuTLS TCP Server/Client with Client Authentication
#!/usr/bin/env sh
set -e
OUTDIR="$(dirname ${0})"
printf 'Output directory: %s\n' "${OUTDIR}"
printf 'ca\ncert_signing_key' > template
certtool --generate-privkey > "${OUTDIR}/ca-key.pem"
@utoni
utoni / HowTo-nDPI-MIPS.md
Last active September 22, 2021 16:09
Compile and Test nDPI for MIPS (big-endian) on Debian

This tutorial will install a MIPS toolchain, libgpg-error, libgcrypt, libnl-3, libpcap and libnDPI. At the end, it should be possible to run ./tests/do.sh using qemu-mips.

Prerequisites

sudo apt install gcc-mips-linux-gnu qemu-system-mips
mkdir [path-to-build-dir-and-sysroot]
cd [path-to-build-dir-and-sysroot]
@utoni
utoni / index.html
Created May 22, 2020 10:10
Jinja2 // C-Python
<html><body>
Hello {{ name }}!
</body></html>
@utoni
utoni / string_list_vs_trie.c
Created July 20, 2019 16:03
string_list_vs_trie
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <limits.h>
#include <fcntl.h>
#include <time.h>
#include <errno.h>
#include <assert.h>
@utoni
utoni / single_sort.c
Created March 28, 2019 22:40
single sort array check
#include <stdio.h>
#define ARRAY_LEN(arr) (sizeof(arr) / sizeof(arr[0]))
int single_sort(int A[], int N)
{
int i, swap_i = -1, swap_val = -1;
for (i = 1; i < N; ++i) {
if (A[i-1] > A[i]) {
@utoni
utoni / net2.c
Created March 22, 2019 00:04
TcpServerClient2
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
@utoni
utoni / net.c
Created March 22, 2019 00:03
TcpServerClient
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>