Skip to content

Instantly share code, notes, and snippets.

View dalslandan200's full-sized avatar

Henrik Johansson dalslandan200

View GitHub Profile
@dalslandan200
dalslandan200 / main.cpp
Last active March 6, 2020 17:10
C++ iterate all combinations from string(char[]). Only ASCII is supported.
#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
/**
* I could not find anywhere a simple function, which iterates a set of ASCII characters,
* and count them in sequence like various numeric systems (base10, base16, etc.).
*
* In short it tests all possible combinations. While doing it in a numeric counting fashion.
@dalslandan200
dalslandan200 / Profile-Modify.php
Last active November 10, 2019 03:35
E-Mail blacklist and whitelist NOT FINISHED for SMF 2.0.15 (partial file)
// Check email providers
if (!empty($modSettings['enable_restrict_EmailProvider']))
{
// Blacklisted email providers
if (!empty($modSettings['restricted_provider']))
{
$restricted_provider = explode(",", $modSettings['restricted_provider']);
// Iterate each blacklisted domain, and do housecleaning.
foreach ($restricted_provider as $key => $value)
@dalslandan200
dalslandan200 / Profile-Modify.php
Last active November 10, 2019 03:21
E-Mail Whitelisting working correctly for SMF 2.0.15 (partial file)
// Check email providers
if (!empty($modSettings['enable_restrict_EmailProvider']))
{
// Whitelisted email providers
if (!empty($modSettings['accepted_provider']))
{
$accepted_provider = explode(",", $modSettings['accepted_provider']);
// Iterate each whitelisted domain, and do housecleaning.
foreach ($accepted_provider as $key => $value)
@dalslandan200
dalslandan200 / Subs-Post.php
Last active November 8, 2019 19:23
G-suite with TLS for SMF, using AUTH LOGIN with passed username and password (partial file)
// Main partion of code, enabling SMF 2.0.15 via SMTP with TLS to work successfully.
// Remember this only works when using username and password via the SMTP services from G-suite.
// This if-clause and partions of the code is found within the function smtp_mail()
if ($modSettings['mail_type'] == 1 && $modSettings['smtp_username'] != '' && $modSettings['smtp_password'] != '')
{
// Determine the hostname we want to send with each Extended hello and hello.
if (function_exists('gethostname') && gethostname() !== false)
$helo = gethostname(); // Server hostname
elseif (function_exists('php_uname'))
$helo = php_uname('n'); // Server hostname
@dalslandan200
dalslandan200 / gist:9167c848d37ea2bfa91af08b2f552bff
Created July 16, 2019 15:32
Compiling Joulecoin with self compiled openSSL
#1 Be in the directory you want (preferably in /root or ~) or create a new directory to not mix maybe old Joulecoin builds?
#2 Preferably be root user, if not use SUDO to ensure correctness.
#3 Do not continue to next step if you have some error, which potentially indicate the instruction from before didn't finish correctly!
#4 intall openSSL (shared library) and in different directory
wget https://www.openssl.org/source/openssl-1.0.2s.tar.gz
tar -xvzf openssl-1.0.2s.tar.gz
CFLAGS=-fPIC ./config --prefix=/openssl-1.0.2s --openssldir=/openssl-1.0.2s shared
make
make install
@dalslandan200
dalslandan200 / gist:b6c9efc2aad2c73c980fa1cb51c69612
Created September 21, 2018 15:39 — forked from genecyber/gist:46a835038221d8e30cfb
Bitpay insight altcoin p2p alt hashing hotfix
var blockHash = bitcoreUtil.formatHashFull(block.calcHash());
var check = blockHash.substring(0, 4);
if (check != '0000') {
console.log("Scrypt block detected. Falling back to RPC");
self.historicSync.start({forceRPC:1}, function(){
sockets.broadcastSyncInfo(self.historicSync.info());
self.log('[p2p_sync] Done resync.');
});
return;
}
@dalslandan200
dalslandan200 / chainparams.cpp
Created September 11, 2018 06:08
Update checkpoints Joulecoin (NOT FULL FILE!)
static Checkpoints::MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
( 0, uint256("0x0000077e5cce889f0920029bf89e8ecb16f7be38e1019c3e21c26d4687ce11f5"))
( 21998, uint256("0x000000000029b7b1ea497dd917ba5bb78b8453759acc145918c6446205fd7e49"))
( 34124, uint256("0x000000000019c6d8dbd8f693077b5b09dc0df722f4b548ca6cbc9e712aa94935"))
( 68073, uint256("0x00000000000ed8b4432909814f2f0a6a699625833d0e4b88fe69a5807f116ae0"))
( 90016, uint256("0x0000000000156c5c7e98211d60c1bd644ca6cfb0b8ef8b484adc663708d64e5b"))
( 189383, uint256("0x0000000000013e11c889a3d1ebb0d1833227ffa7fb6d06f7ce42e8d8e1fb7dce"))
( 245624, uint256("0x00000000000142ce3a43b4304ab6f886c6fd9a806d83a72c344b24a7d24da7fc"))
( 328190, uint256("0x000000000000f2f362d4f78cad2fa5c03452b90213a29b6be9c94827ce73e1b3"))