Skip to content

Instantly share code, notes, and snippets.

View Ben-0-mad's full-sized avatar
💭
🦎

Lizard Ben-0-mad

💭
🦎
View GitHub Profile
#include <iostream>
#include <chrono>
#include <thread>
int main() {
using namespace std::literals::chrono_literals;
std::cout << "hi ";
std::this_thread::sleep_for(2s);
std::cout << "bye";
@Ben-0-mad
Ben-0-mad / timer.cpp
Created August 20, 2021 23:20
C++ timing of fuctions
#include <iostream>
#include <chrono>
long add(int a, int b) {
return a + b;
}
int main() {
auto start = std::chrono::steady_clock::now();
std::cout << "9 + 10 = " << add(9, 10) << '\n';
@Ben-0-mad
Ben-0-mad / getrequest.cpp
Last active August 20, 2021 15:09
Example of HTTP GET request using winsock
#include <iostream>
#include <string>
#include <WS2tcpip.h>
#pragma comment (lib, "ws2_32.lib")
// Example of HTTP GET request using windows sockets
// Author: Maniclout
void getrequest() {
@Ben-0-mad
Ben-0-mad / fftwexample.cpp
Created August 7, 2021 14:06
FFT of (0,1,2,3,4,5,6,7) using FFTW3
#include <fftw3.h>
#include <iostream>
int main()
{
int numOfPoints = 8;
fftw_complex* input = new fftw_complex[numOfPoints];
fftw_complex* output = new fftw_complex[numOfPoints];
for (int i = 0; i <numOfPoints; i++){
#include <iostream>
#include<sstream>
#include<string>
#include<cmath>
#include<ctime>
int random(int low, int high){
return low + (std::rand() % (high - low + 1));
}