Skip to content

Instantly share code, notes, and snippets.

View goertzenator's full-sized avatar

Daniel Goertzen goertzenator

View GitHub Profile
@goertzenator
goertzenator / rtest.rs
Created June 23, 2016 21:26
associated static attempt
trait Resource {
fn resource() -> &'static mut i32;
}
struct MyStruct;
fn main() {
*u8::resource() = 123;
*MyStruct::resource() = 456;
g550jk ~ # emerge -upvN --deep @world
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild U ~] dev-qt/qtcore-5.6.1:5/5.6::gentoo [5.5.1-r1:5/5::gentoo] USE="icu -debug -systemd {-test}" 45,692 KiB
[ebuild U ~] dev-qt/qtxml-5.6.1:5/5.6::gentoo [5.5.1:5/5::gentoo] USE="-debug {-test}" 0 KiB
[ebuild U ~] dev-qt/qtnetwork-5.6.1:5/5.6::gentoo [5.5.1:5/5::gentoo] USE="ssl -bindist -connman -debug -libproxy -networkmanage
r {-test}" 0 KiB
@goertzenator
goertzenator / gist:fc679993ef92fa63545bccd80a78d9d3
Created July 6, 2016 19:10
struct vs int calling convention issue
I had a Rust plugin for Erlang that exposed the following function type:
extern "C" fn(env: *mut ErlNifEnv, argc: c_int, argv: *const ERL_NIF_TERM) -> ERL_NIF_TERM;
where...
#[allow(non_camel_case_types)]
pub type size_t = usize;
diff --git a/examples/nifpptest.cpp b/examples/nifpptest.cpp
index bdda528..570e384 100644
--- a/examples/nifpptest.cpp
+++ b/examples/nifpptest.cpp
@@ -279,7 +279,7 @@ ERL_NIF_TERM nif_main(ErlNifEnv* env, nifpp::TERM term)
else if(cmd=="list2bc") { return list2_test<std::deque <nifpp::TERM> >(env, cmddata); }
else if(cmd=="list2bd") { return set2_test<std::set <nifpp::TERM> >(env, cmddata); }
else if(cmd=="list2be") { return list2_test<std::multiset <nifpp::TERM> >(env, cmddata); }
- else if(cmd=="list2bf") { return set2_test<std::unordered_set<nifpp::TERM> >(env, cmddata); }
+ // else if(cmd=="list2bf") { return set2_test<std::unordered_set<nifpp::TERM> >(env, cmddata); }
@goertzenator
goertzenator / windows_expanded.rs
Created January 27, 2017 15:44
erlang_nif-sys expansion under Windows
#![feature(prelude_import)]
#![no_std]
/*!
Low level Rust bindings to the [Erlang NIF API](http://www.erlang.org/doc/man/erl_nif.html).
# NIF Crate
A NIF module is built by creating a new crate that uses `erlang_nif-sys` as a dependency.
(more)
@goertzenator
goertzenator / rebar3_rust_compile_prv.erl
Created March 10, 2017 16:40
namespaced provider with options
-module(rebar3_rust_compile_prv).
-export([init/1, do/1, format_error/1]).
-include_lib("kernel/include/file.hrl").
-define(PROVIDER, build).
-define(NAMESPACE, rust).
-define(DEPS, [{default,app_discovery}]).
goertzen@asus_laptop_wired ~/puretest $ pulp test
* Building project in /home/goertzen/puretest
Compiling Test.Main
Warning found:
in module Test.Main
at test/Main.purs line 8, column 1 - line 9, column 28
No type declaration was provided for the top-level declaration of main.
It is good practice to provide type declarations as a form of documentation.
The inferred type of main was:
@goertzenator
goertzenator / gist:9f70d159c814298e7ea84d3b51690e74
Created May 22, 2017 01:38
Arma 3 dedicated linux segfault
19:37:46 Updating base class ->Car_F, by a3\soft_f\config.bin/CfgVehicles/Truck_F/ (original a3\soft_f\config.bin)
19:37:46 Updating base class ->BlendAnims, by a3\soft_f_kart\kart_01\config.bin/CfgMovesMaleSdr/BlendAnims/ (original (a3\anims_f\config\sdr\config.bin - no unload))
19:37:46 Updating base class RscText->ctrlStaticBackgroundDisable, by a3\3den\config.bin/RscDisplayOptionsAudio/ControlsBackground/BackgroundDisable/ (original a3\3den\config.bin)
19:37:46 Updating base class RscText->ctrlStaticBackgroundDisableTiles, by a3\3den\config.bin/RscDisplayOptionsAudio/ControlsBackground/BackgroundDisableTiles/ (original a3\3den\config.bin)
19:37:46 Updating base class RscText->ctrlStaticBackgroundDisable, by a3\3den\config.bin/RscDisplayConfigure/ControlsBackground/BackgroundDisable/ (original a3\3den\config.bin)
19:37:46 Updating base class RscText->ctrlStaticBackgroundDisableTiles, by a3\3den\config.bin/RscDisplayConfigure/ControlsBackground/BackgroundDisableTiles/ (original a3\3den\config.bin)
19:37:46
[goertzen@asusnixos:~/eco]$ touch Configs/hello
touch: cannot touch 'Configs/hello': Permission denied
[goertzen@asusnixos:~/eco]$ id
uid=1000(goertzen) gid=100(users) groups=100(users),1(wheel),17(audio),57(networkmanager)
[goertzen@asusnixos:~/eco]$ ls -aln
total 0
drwxr-xr-x 1 1000 100 54 May 21 14:04 .
drwx------ 1 1000 100 1294 May 21 14:09 ..
home@i7desktop /cygdrive/c/Users/home/Desktop/mindustry-4.0-alpha-58
$ ./Mindustry.exe 2>&1 | tr ';' '\n'
java.lang.Error:
There is an incompatible JNA native library installed on this system
Expected: 5.1.0
Found: 4.0.0
C:\Users\home\Desktop\mindustry-4.0-alpha-58
C:\WINDOWS\Sun\Java\bin
C:\WINDOWS\system32