Skip to content

Instantly share code, notes, and snippets.

A.W. Stanley awstanley

  • Sydney, Australia
View GitHub Profile
@awstanley
awstanley / constexpr crc32 proof of concept.cpp
Last active Nov 28, 2018
CRC32 at compile time proof of concept. This can be expanded to virtually any other hash, and probably adapted to be cleaner in design (using the hash function as a template argument).
View constexpr crc32 proof of concept.cpp
#include <cstdint>
namespace {
/// IEEE CRC32 table.
static constexpr std::uint32_t crc32_table[] = {
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
@awstanley
awstanley / CMakeLists.txt
Last active Nov 29, 2017
CMake helper file. I've kept many copies of this semi-private for years, this one just contains a little more code to help people along. (Updated to include some missing defines, all of the ones in the current test project, so as to be sure they're all there.)
View CMakeLists.txt
# Copyright 2014-2017 A.W. 'aws' Stanley.
#
# Licensed under the Apache Licence, Version 2.0 [1] or
# MIT licence [2], at your option. This file may not be
# copied, modified, or distributed except according to
# those terms.
#
# [1] <http://www.apache.org/licenses/LICENSE-2.0>
# [2] <http://opensource.org/licenses/MIT>
View factory setup
0eNqlnetuXEeuhd9Fv62g7pe8ysHgwHY0GQGOZEjtgwkCv/uRM2q7J6ndWuurX0HieBWbxeKuIhfJP24+fPpy9/np/uF08/MfN/cfHx+eb37+nz9unu9/fXj/6dt/O/3++e7m55v7091vN+9uHt7/9u3f7v79+enu+fn29PT+4fnz49Pp9sPdp9PN13c39w+/3P375uf49d3bIJ/uPp6e7j/e/vPL08P7j3cXfz19/ce7m7uH0/3p/u4/Av35L7//78OX3z7cPb3gvyXKu5vPj88vf/3x4dv6L5C3ub67+f3ln7G/rPPL/dPL4n/+afkm6l/gE4BvOnz24VPU4QuATzp89eG7jt589KGjdxvdEH3Y4IbNTBvcMZkYfPhgwPvn1Tmu0T+vuRjw4LyW/Irf/hs/rfDBgS3FwK8b+PXrCrFtaKQKEneAHw2NDICfDPy5Ib+gnxQ25Ffwyfd16vpJ4ANbgoGfN+RX9FM25FfwwYnNw9APOL+5r/GX96e+IX8V8P9+fp8/f7o/nV7+cHU1+6ka2HPjbinoJoeNy6WCHy3dFEc3OW3cXBXZd27Givw7V2NF/rqBr8jf+N1bge8cXtHO4Hd7BX5yeEE5JeC3g4IeMbqgmpLw00RBzxhd0UzhLx8FvnJ4RTeNP6wU+M7hFeUM/m5TpJ8cXpC+Bv4sFKSvkcMr0qeNV1tZvdpq3kDMS8Sy8Q5cy1g3ENcy7tx1s7BPO3fd/PZdvXp33f79PlcE2efGXVTQTQuW7NWRvdF7riI3CQAXQ/ade66Cv3PPVfB37rmK/puztylYe7txyVVUs3HJVeAnl15QTg9cegXeOrPV2dae8AVaUHvnV1wFvWB0RTPVUHq3dN743VlRy8blVoEfHF5RzjTUnqKj9xH4vVlQzNjI1ijSb2RrFPjM4RXl7CRr0uqCOnbSM3GJuJOeWcvYNxDXMo6Na3kS9mnCEHEUcrE7IVxB9rlDb1DkTxv4ivwk/ZLX+Ksn0Swb13MFn6RfooFPnqTJwP9xWp8
View testsga.go
package main
import (
_ "github.com/awstanley/go.sga"
"image"
"image/png"
"os"
)
func main() {
@awstanley
awstanley / dl.go
Created Jul 17, 2016
Elusive Target Tracker (downloads current manifest; will throw an error an m will be nil if it's down). Obviously it needs work, but it was developed rapidly during ET #6 as a proof of concept.
View dl.go
package main
import (
"github.com/awstanley/Hitman/Go/misc/elusivetracker"
"net/http"
)
func main() {
client := &http.Client{}
@awstanley
awstanley / hitman.txt
Created May 15, 2016
Hitman Benchmark (2016-05-15 11:34pm UTC)
View hitman.txt
System Info:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
CPU Cores: 8
CPU Speed: 3.40GHz
System Memory: 10.17GB / 15.90GB
GPU: AMD Radeon R9 200 / HD 7900 Series
GPU Memory: 2.98GB
Graphics Settings:
@awstanley
awstanley / dom4_pretender.cpp
Last active Mar 30, 2016
Dominions 4 Pretender Parser (proof of concept)
View dom4_pretender.cpp
#include <stdint.h>
#include <fstream>
#include <string>
#include <vector>
struct FileHeader
{
/* 0 */char header[6];
/* 6 */uint32_t serial;
View CMakeLists.txt
project("tilemapA5")
cmake_minimum_required(VERSION 3.4)
set(EXE_NAME "tilemapA5")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include("D:\\a5\\builder\\AllegroDependencies.cmake")
add_executable(${EXE_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp")
LINK_ALLEGRO(${EXE_NAME})
install(TARGETS ${EXE_NAME} RUNTIME DESTINATION "${CMAKE_BINARY_DIR}/build")
@awstanley
awstanley / StrippedBackExample.cs
Last active Aug 29, 2015
Space Engineers related code. Stripped back example of the lag causing code. (Updated to include DateTime code, typed manually into it from newer code; it should work, and I tested the error-free nature of it briefly in creative on a random block).
View StrippedBackExample.cs
//---------------------------------------------------------------------
// Configuration variables. Define this once, use it everywhere.
// (Save yourself the headache of rewriting it over and over again...)
//
// Two key points here:
// (1) All points should be out of standard usage (e.g. ☼ § « »);
// (2) Anything which MAY need to be typed (ever), should be available
// easily via ASCII or CharMap (for user access). Anything else
// (list delimiting) should be done sanely but copy+paste should
// be more than enough.
@awstanley
awstanley / Name_DetailedInfo.cs
Created Jan 6, 2015
Space Engineers script to get information from the block (CSV, but you need to parse it out)
View Name_DetailedInfo.cs
void Main()
{
for (int block = 0; block < GridTerminalSystem.Blocks.Count; block++)
{
if (GridTerminalSystem.Blocks[block] is IMyTerminalBlock)
{
IMyTerminalBlock Block = GridTerminalSystem.Blocks[block];
StringBuilder Str = new StringBuilder(); Str.Append(Block.BlockDefinition.ToString());
Str.Append("[" + Block.DetailedInfo + "] ");
Block.SetCustomName(Str);
You can’t perform that action at this time.