This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy import sqrt, Rational | |
def solve_equation_brute_force(n): | |
''' | |
Brute Force Method: | |
This method involves iterating through possible values of xx and yy until a solution is found. | |
''' | |
solutions = [] | |
for y in range(1, 10000): # Adjust the range as needed | |
x_squared = n * y * y - 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int wang_hash(int seed) | |
{ | |
seed = (seed ^ 61) ^ (seed >> 16); | |
seed *=9; | |
seed = seed ^ (seed >> 4); | |
seed *= 0x27d4eb2d; | |
seed = seed ^ (seed >> 15); | |
return seed; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Required: Visual Studio 2015 or 2017 (or probably later works) | |
Setup | |
1. Clone/download OpenSSL 1.1.1 source to a folder | |
2. Download / install Perl (They recommend Active perl) | |
I recommend using Chocolatey so for me: choco install activeperl | |
3. Ensure Perl is in the system path. (Choco appears to do this by default) | |
4. Download / install NASM | |
I recommend using Chocolatey so for me: choco install nasm | |
5. Ensure NASM is in the system path. (For me the directory to add was C:\Program Files\NASM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cmath> | |
inline void dectobin(int indec, int len) { | |
using namespace std; | |
long ndec = indec % (long)(pow(2.0, len)); // truncating to max length! | |
for (int i = len - 1; i >= 0; i--) | |
{ | |
long pw = (long)pow(2.0, i); | |
if (ndec - pw >= 0) { | |
printf("1"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CustomModel.cpp | |
#include "custommodel.h" | |
CustomModel::CustomModel(QObject *parent) | |
: QAbstractItemModel(parent), m_rootItem(nullptr) | |
{ | |
// Create the root item | |
m_rootItem = new TreeItem("Root"); | |
// Populate the model with data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mainwindow.h" | |
#include "ui_mainwindow.h" | |
#include "form.h" | |
MainWindow::MainWindow(QWidget *parent) | |
: QMainWindow(parent) | |
, ui(new Ui::MainWindow) | |
{ | |
ui->setupUi(this); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include <cstdlib> | |
#include <algorithm> | |
#include <fstream> | |
#include <numeric> | |
#include <string> | |
#include <Eigen/Dense> | |
using namespace Eigen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <Eigen/Dense> | |
#include <Eigen/Geometry> | |
#include <fstream> | |
#include <Eigen/StdVector> | |
#include <cmath> | |
using namespace std; | |
template <typename T> | |
using Matrix = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
//TODO include appropriate headers | |
#include <QtCore/QtCore> | |
#include <QtXml/QtXml> | |
bool readSettingsXml(QIODevice &device, QMap<QString, QVariant> &map); | |
bool writeSettingsXml(QIODevice &device, const QMap<QString, QVariant> &map); | |
static const QSettings::Format xmlFormat = QSettings::registerFormat("xml", &readSettingsXml, &writeSettingsXml); | |
static const QString rootName = "config"; |
NewerOlder