Skip to content

Instantly share code, notes, and snippets.

View goertzenator's full-sized avatar

Daniel Goertzen goertzenator

View GitHub Profile
snmp_user({create, Record0}) ->
Table = snmp_user,
% merge defaults
Record = maps:merge(#{engine_id=>local}, Record0),
case Record of
#{security_model := SecurityModel,
security_name := SecurityName,
access_type := AccessType}
when is_list(SecurityName),
snmp_user2({create, Record0}) ->
map_table:maybe_transaction(
fun() ->
Record = maps:merge(#{engine_id=>local}, Record0),
snmp_user_create(Record)
end).
snmp_user_create(Record=#{ security_model := SecurityModel,
security_name := SecurityName,
access_type := AccessType})
@goertzenator
goertzenator / gist:8a2641757e71a6191e84
Created October 26, 2014 12:34
undefined symbol: xcb_get_reply_fds
MultiMC version: 0.4.2
Minecraft folder is:
/home/goertzen/Desktop/MultiMC/instances/1.8 vanilla/minecraft
Java path is:
java
Java Arguments:
[-Xms512m, -Xmx1024m, -Duser.language=en, -jar, /home/goertzen/Desktop/MultiMC/bin/jars/NewLaunch.jar]
@goertzenator
goertzenator / gist:6237e0200a5f7bf22976
Created October 31, 2014 20:19
dirty nif build and segfault
goertzen-G550JK dlibusb # make V=1
erl -noshell -noinput -eval "file:write_file(\"env.mk\", \
io_lib:format(\"ERTS_INCLUDE_DIR ?= ~s/erts-~s/include/\", \
[code:root_dir(), erlang:system_info(version)])), \
init:stop()."
erlc -v -Werror +debug_info +warn_export_all +warn_export_vars +warn_shadow_vars +warn_obsolete_guard -o ebin/ -pa ebin/ -I include/ src/dlibusb_nif.erl src/dlibusb_sup.erl src/dlibusb_app.erl src/dlibusb.erl
cat src/dlibusb.app.src \
| sed "s/{modules,[[:space:]]*\[\]}/{modules, \['dlibusb_nif', 'dlibusb', 'dlibusb_app', 'dlibusb_sup'\]}/" \
> ebin/dlibusb.app
cc -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes -I/usr/local/lib/erlang/erts-6.2/include/ -fPIC -c -o /device/apps/erlapps/dlibusb/c_src/dlibusb.o /device/apps/erlapps/dlibusb/c_src/dlibusb.c
@goertzenator
goertzenator / sftest
Created November 3, 2014 17:30
instruction to build Gentoo chroot and Elrang to demonstrate segfault
# do everything in throw-away dir
mkdir sftest
cd sftest
# get and expand gentoo chroot
wget http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/releases/x86/current-iso/stage3-i486-20141028.tar.bz2
wget http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/snapshots/portage-20141102.tar.bz2
mkdir chroot
sudo tar -jxf stage3-i486-20141028.tar.bz2 -C chroot
sudo tar -jxf portage-20141102.tar.bz2 -C chroot/usr
@goertzenator
goertzenator / gist:1e90c2d53d131d159829
Created January 28, 2015 18:28
static c string test
extern crate libc;
use libc::c_int;
use libc::c_uchar;
extern {
fn puts(s:*const c_uchar) -> c_int;
}
def decode_bytes(bin):
try:
bcr_table = pickle.loads(bin)
except (ValueError, EOFError):
bcr_table = etf.binary_to_term(bin)
return bcr_table
$ RUST_BACKTRACE=1 cargo build --verbose
Compiling libc v0.1.5
Running `rustc /home/goertzen/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.1.5/rust/src/liblibc/lib.rs --crate-name libc --crate-type lib -g --cfg feature="cargo-build" --cfg feature="default" -C metadata=8c77960f0e8d4e86 -C extra-filename=-8c77960f0e8d4e86 --out-dir /home/goertzen/rusttest1/liblrust/target/debug/deps --emit=dep-info,link -L dependency=/home/goertzen/rusttest1/liblrust/target/debug/deps -L dependency=/home/goertzen/rusttest1/liblrust/target/debug/deps -Awarnings`
Compiling liblrust v0.0.1 (file:///home/goertzen/rusttest1/liblrust)
Running `rustc src/lib.rs --crate-name rustertest --crate-type staticlib -g -C metadata=df29ab0826b044a6 -C extra-filename=-df29ab0826b044a6 --out-dir /home/goertzen/rusttest1/liblrust/target/debug --emit=dep-info,link -L dependency=/home/goertzen/rusttest1/liblrust/target/debug -L dependency=/home/goertzen/rusttest1/liblrust/target/debug/deps --extern libc=/home/goertzen/rustt
@goertzenator
goertzenator / gist:cbc08a3f668b0af55384
Created April 16, 2015 15:46
Qt Creator 3.3.2 segfault
$ LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so ~/Qt/Tools/QtCreator/bin/qtcreator
*** Segmentation fault
Register dump:
RAX: 0000000000000000 RBX: 0000000001fe7450 RCX: 0000000000008080
RDX: 0000000001fcc6f0 RSI: 00007fffb040e3b0 RDI: 0000000001fe73f0
RBP: 0000
-module(index).
-compile(export_all).
-include_lib("n2o/include/wf.hrl").
-include_lib("nitro/include/nitro.hrl").
main() -> #dtl{ file="basic",
bindings = [{body, body()}, {title, title()}]
}.