Skip to content

Instantly share code, notes, and snippets.

View ArthurFerreira2's full-sized avatar
🇫🇷
coding out loud

ArthurFerreira2

🇫🇷
coding out loud
View GitHub Profile
@ArthurFerreira2
ArthurFerreira2 / gag.py
Last active February 10, 2022 22:51
GNS3 Alias Generator
#!/usr/bin/env python3
# Copyright (c) 2022 Arthur Ferreira
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@ArthurFerreira2
ArthurFerreira2 / sorts.cpp
Created October 17, 2021 20:50
Implementation in C++ of the classical bubble, selection, insertion, quick, standard, shell and radix sort algorithms
#include <iostream>
#include <vector>
#include <chrono>
#include <algorithm>
#include <limits.h>
using std::chrono::high_resolution_clock;
using std::chrono::duration;
@ArthurFerreira2
ArthurFerreira2 / isPrime.cpp
Created October 17, 2021 20:47
multi threading prime number
#include <iostream>
#include <cmath>
#include <thread>
#include <future>
typedef unsigned long long int huge;
bool hasDivisors = false; // until we find one
// Thread function
@ArthurFerreira2
ArthurFerreira2 / fizzbuzz.cpp
Created October 17, 2021 20:46
The classical fizzBuzz
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
cout << endl;
for(int i=1; i<=100; i++){
if ( !((i%3) || (i%5)) ) // Loi de morgan : « non(A ou B) » equivaut à « (non A) et (non B) ».
// if (!(i%15)) ... if you take the time to think a bit !
@ArthurFerreira2
ArthurFerreira2 / collatz.cpp
Created October 17, 2021 20:44
The classic Collatz
#include <iostream>
#define NUM 20000
#define MAX_ITER 100000
int main() {
int results[NUM] = {0};
int maxIter = 0;
int numberForMaxIter = 0;