Skip to content

Instantly share code, notes, and snippets.

@Steve132
Steve132 / eventy.hpp
Created October 19, 2023 06:04
Eventy.hpp
#pragma once
#include<vector>
#include<cstdint>
#include<cstdlib>
#include<algorithm>
namespace eventy{
@Steve132
Steve132 / Output1.txt
Last active June 21, 2023 00:35 — forked from VirtuosoChris/groupimages.py
groupimages.py
image0 in group_0 0
image1 in group_0 1
image2 in group_0 2
image3 in group_0 3
Processing: 1/12 groups. 8.33% done.
image5 in group_1 5
image7 in group_1 7
Processing: 2/12 groups. 16.67% done.
image9 is unmatched
Processing: 2/12 groups. 16.67% done.
template<class T>
struct minihive:
public std::pmr::list<T>; //iterators and everything work the same way from this root.
{
protected:
using base_type=std::pmr::forward_list<T>;
using iterator=base_type::iterator;
minihive():
std::pmr::polymorphic_allocator<T>(inner_pool),
find_package(Python COMPONENTS Interpreter) #make sure you have python and populate Python::Interpreter from the system.
add_executable(sometool sometool.cpp) #the target for the tool that generates the code.
#I assume that somescript.py accepts two arguments: the path to sometool.exe and the path to the output
set(MY_SCRIPT_OUTPUT "${CMAKE_CURRENT_BUILD_DIR}/generated.cpp")
add_custom_command(OUTPUT "${CMAKE_CURRENT_BUILD_DIR}/generated.cpp" #...additional outputs here if necessary
COMMAND Python::Interpreter
@Steve132
Steve132 / Foo.cpp
Last active March 16, 2017 21:55
Example Circular Include Failure
#include "Foo.h"
Foo::Foo()
{
}
void member()
{
}
Secure protocol for blockchain voting:
First, a voter registers some kind of authentication system (dongle, registration card, password, all of the above?)
A voter authenticates.
Vote workers (or a machine printer?) gives them a 'ballot' which is a pre-decided card with QR codes on it representing a signed transaction from the election commisssion account
to the address. then
Ballots can easily be independently checked if they have already been used or if they do not go to the proper locations.
@Steve132
Steve132 / quantum_sha.cpp
Last active August 17, 2016 14:56
Simple Quantum Sha1
//THis is an implementation for a quantum simulator showing that sha1 iterations are computable and reversible with no global ancillary bits and one *local*
//ancillary register that is uncomputed per iteration. This iteration is only 5 bits, of course, for space.
#include<qcpp/QRegister.h>
#include<qcpp/QMachine.h>
uint32_t msha1_computeF(int i,QRegister& B,QRegister& C,QRegister& D,QRegister& F)
{
static const uint32_t k[4]=[0x5A827999,0x6ED9EBA1,0x8F1BBCDC,0xCA62C1D6]
switch(i/20)
@Steve132
Steve132 / sharethis.py
Created December 4, 2015 20:53
Python server download
import SimpleHTTPServer
import SocketServer
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("gmail.com",80))
IP=s.getsockname()[0]
s.close()
PORT = 8000
@Steve132
Steve132 / offline_mnemonic_gen.py
Last active November 9, 2015 23:01
Offline BIP039 implementation using your own entropy.
import sys
import hashlib
import argparse
import binascii
import os
import math
def entropy_dice(entropy):
dicesize=int(raw_input("Enter the number of faces each dieroll has (e.g. '6' or '20'): "))
entval=0
@Steve132
Steve132 / syg.cpp
Last active November 3, 2015 20:32
StandYourGround game
#include<iostream>
#include<string>
#include<vector>
#include<cstdlib> //rand
#include<ctime> //time
using namespace std;
int quizQuestion(const std::string& question,const std::vector<std::string>& options)
{
cout << question << endl;