Skip to content

Instantly share code, notes, and snippets.

View hostilefork's full-sized avatar
🌴
I'm Always Somewhere...but I'll Try And Respond

Hostile Fork hostilefork

🌴
I'm Always Somewhere...but I'll Try And Respond
View GitHub Profile
@hostilefork
hostilefork / gist:8dc9ae2f2dead34e3a76219a34b4f836
Created April 21, 2018 08:52
Building with Mingw32-make fails for Windows #564 (moved to gist)
C:\Users\kealist\Documents\git\kealist\ren-c\make>mingw32-make -f makefile.boot
./r3-make.exe -qs ../src/tools/make-make.r OS_ID=""_"" DEBUG="asserts" \
GIT_COMMIT="{unknown}" STANDARD="c" \
RIGOROUS="no" WITH_FFI="no" \
WITH_TCC="no" STATIC="no" \
OPTIMIZE="auto" TARGET=makefile CONFIG="default-config.r"
/C/Users/kealist/Documents/git/kealist/ren-c/src/tools/
user-config: => make object! [
os-id blank! _
target word! makefile
@hostilefork
hostilefork / listener.c
Last active April 16, 2024 15:32
Simple listener and sender for UDP multicast
//
// Simple listener.c program for UDP multicast
//
// Adapted from:
// http://ntrg.cs.tcd.ie/undergrad/4ba2/multicast/antony/example.html
//
// Changes:
// * Compiles for Windows as well as Linux
// * Takes the port and group on the command line
//
// Test for http://stackoverflow.com/questions/8455887/stack-object-qt-signal-and-parameter-as-reference/
#include <iostream>
#include <QCoreApplication>
#include <QTimer>
#include "param.h"
int main(int argc, char *argv[])
{
@hostilefork
hostilefork / how-many-numbers-with-length-n-with-k-digits-d-consecutively
Last active August 29, 2015 14:07
Test log of "zero-aware" consecutive digit counting algorithm
// "Fast way" results from code by Pham Trung
// ( as of this revision http://stackoverflow.com/revisions/26422842/6 )
// "Slow way" results from the following brute-force C++ code
long FSlowCore(int N, int K, int D, vector<int> & digits) {
if (N == 0) {
auto startPos = find_if(digits.begin(), digits.end(), [](int x) {return x != 0;});
if (startPos != digits.begin())
return 0;
if (search_n(startPos, digits.end(), K, D) != end(digits)) {
@hostilefork
hostilefork / stackoverflow-2521865
Created October 17, 2014 21:08
how-many-numbers-with-length-n-with-k-digits-d-consecutively
// Test output for
// http://stackoverflow.com/questions/26421865/how-many-numbers-with-length-n-with-k-digits-d-consecutively/26426615
when N = 0 and K = 0 and D = 6:
Fast way gives 0
Slow way gives 0
when N = 0 and K = 1 and D = 6:
Fast way gives 0
Slow way gives 0
@hostilefork
hostilefork / 1-rebol.reb
Last active August 29, 2015 14:07
Tinker to try and make a Rebol dialected version of the CMake build file WIP for Rebol
Rebmake [
Title: "Rebol Dialected Experiment to represent CMake files"
;; See:
;; http://curecode.org/rebol3/ticket.rsp?id=2177
;; http://browsenpm.org/package.json#dependencies
Needs: [
1.0
cmake 2.8
]
@hostilefork
hostilefork / red-eval-941.txt
Last active August 29, 2015 14:06
Simple reduce case for Red Issue #941 (with full debug verbosity in interpreter.reds)
;; https://github.com/red/red/issues/941
red>> foo: function [] [a: 10 b: 20 return [a b]]
== func [/local a b][a: 10 b: 20 return [a b]]
red>> reduce foo
;-- skip console boilerplate head code
eval: action/native return type: 2
eval: root loop...
eval: fetching value of type 20
@hostilefork
hostilefork / ideone-map.reb
Last active August 29, 2015 13:57
IDEone language mappings
;-- Language mappings from word! to integer! for IDEone
;--
;-- adapted from: https://ideone.com/faq
;-- (supported languages subsection)
;--
;-- Capture made on 18-Mar-2014 by @HostileFork
[
ada 7 ; gnat-4.6
@hostilefork
hostilefork / whitespace-output.txt
Created January 26, 2014 05:26
Output from Whitespace test program run by Rebol interpreter
WHITESPACE INTERPRETER FOR PROGRAM:
---
@hostilefork
hostilefork / facade.cpp
Last active December 27, 2015 06:19
Conceptual example for Proxy/Facade pattern to submit to http://codereview.stackexchange.com/questions/33713/
//
// Proxy/facade pattern idea.
// See http://codereview.stackexchange.com/questions/33713/
//
#include <iostream>
#include <vector>
#include <memory>
#include <cstdlib>