Skip to content

Instantly share code, notes, and snippets.

View caloni's full-sized avatar

Wanderley Caloni caloni

View GitHub Profile
/* Solves
* https://www.hackerrank.com/challenges/array-and-simple-queries/problem
* But without caring about limited resources =)
* @author Wanderley Caloni <wanderley.caloni@gmail.com>
* @date 2024-09-05
*/
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
/*
Multiple peers Wireguard calculation
Wireguard does not support overlapping allowed ips for multiple peers. To cover all possible ips excluding others for secondary peers some calculation is needed to mount the allowed ips list derived from 0.0.0.0.
*/
using System.Net;
public class Program
{
private static void CalculateWireguardAllowedIps(ref HashSet<IPNetwork2> list, IPNetwork2 ip, IPNetwork2 remove)
@caloni
caloni / joao_pedro_brites.cpp
Last active February 10, 2023 10:21
João Pedro Brites no Império C++
//******TESTAR EM LINUX******
//*******CONFERIR SE A IDENTAÇÃO ESTÁ HOMOGENEA OU ESPACOS OU TAB********
//*****CRIAR CABEÇALHO******
//TODO colocar exemplo de CSV, já que ele começa lendo um.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#define MAX_BEBIDAS_NA_ESTEIRA 3
#define MAX_ESTEIRAS 2
typedef struct esteira_s
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int cmpstr(void const *a, void const *b)
{
const char const *aa = *(const char const **)a;
const char const *bb = *(const char const **)b;
return strcmp(aa, bb);
#include <string>
#include <iostream>
enum string_code
{
sc_1,
sc_2,
sc_3,
sc_none
};
#include <string>
#include <iostream>
#define switch(a) auto switch_cmp = a;
#define case(a) if( switch_cmp == a )
int main()
{
std::string test = "3";
#include <stdio.h>
#include <string.h>
int M[100][100];
int J[100];
int main() {
int T, N, n, t, i, j, k, ic, ii, jj, kk;
scanf("%d", &T);
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from itertools import islice
TilePositions = [
[32, 216], [153, 216], [274, 216], [395, 216],
[32, 339], [153, 339], [274, 339], [395, 339],
[32, 461], [153, 461], [274, 461], [395, 461],
[32, 584], [153, 584], [274, 584], [395, 584]
/** Imprime uma tabela alinhando a primeira coluna à esquerda e a segunda
coluna à direita, respeitando o tamanho do maior campo da primeira coluna.
*/
void printf_string_align_variable_size()
{
struct GitBranches branches[2];
char* cr;
size_t len1, len2, maxlen;
printf("master branch: ");