Skip to content

Instantly share code, notes, and snippets.

@00-matt
00-matt / Dockerfile-10.16.0
Last active July 6, 2019 10:22
Docker Images for Node.js and Yarn - https://hub.docker.com/r/offtopica/nodejs
FROM debian:buster AS builder
ENV NODE_VERSION 10.16.0
ENV YARN_VERSION 1.16.0
COPY KEYS.* /tmp/
WORKDIR /root
RUN set -ex; \
@00-matt
00-matt / Makefile
Created August 7, 2019 10:18
Lua 5.3 Bytecode Example
LDLIBS = -llua5.3
.PHONY: all
all: build run
build: build.c
run: run.c
.PHONY: clean
@00-matt
00-matt / Makefile
Last active August 7, 2019 10:20
x86_64 Linux ASM Example
.PHONY: all
all: hello
hello: hello.o
$(LD) hello.o -o hello
hello.o: hello.S
$(AS) hello.S -o hello.o
.PHONY: clean
@00-matt
00-matt / bin200.wat
Created August 8, 2019 22:50
bin200 WASM disassembly
(module
(type (;0;) (func (param i32 i32) (result i32)))
(type (;1;) (func (result i32)))
(type (;2;) (func))
(import "env" "__memory_base" (global (;0;) i32))
(import "env" "memory" (memory (;0;) 256))
(func (;0;) (type 0) (param i32 i32) (result i32)
local.get 0
global.get 0
i32.const 5242900
the
the quick
the quick brown
the quick brown fox
quick
quick brown
quick brown fox
quick brown fox jumped
brown
brown fox
#!/bin/sh
# IN: deadbeef
# OUT: \xde\xad\xbe\xef
hexify() {
echo "$1" | fold -w 2 | sed -e 's/^/\\x/' | paste -s -d ''
}
@00-matt
00-matt / JsonRpcClient.js
Created September 21, 2019 16:09
A Node.js JSON-RPC client
/*
* JsonRpcClient.js 1.0 - A Node.js JSON-RPC client
*
* Written in 2019 by Matt Smith <matt@offtopica.uk>
*
* To the extent possible under law, the author(s) have dedicated all
* copyright and related and neighboring rights to this software to
* the public domain worldwide. This software is distributed without
* any warranty.
*
find_path(HTTP_PARSER_INCLUDE_DIR NAMES http_parser.h)
mark_as_advanced(HTTP_PARSER_INCLUDE_DIR)
find_library(HTTP_PARSER_LIBRARY NAMES http_parser libhttp_parser)
mark_as_advanced(HTTP_PARSER_LIBRARY)
if(DEFINED HTTP_PARSER_INCLUDE_DIR)
file(STRINGS "${HTTP_PARSER_INCLUDE_DIR}/http_parser.h" _HTTP_PARSER_H REGEX
"#define HTTP_PARSER_VERSION_(MAJOR|MINOR|PATCH) [0-9]+")
foreach(c MAJOR MINOR PATCH)
find_path(LIBUV_INCLUDE_DIR NAMES uv.h)
mark_as_advanced(LIBUV_INCLUDE_DIR)
find_library(LIBUV_LIBRARY NAMES uv libuv)
mark_as_advanced(LIBUV_LIBRARY)
if(DEFINED LIBUV_INCLUDE_DIR AND EXISTS "${LIBUV_INCLUDE_DIR}/uv/version.h")
file(STRINGS "${LIBUV_INCLUDE_DIR}/uv/version.h" _LIBUV_H REGEX
"#define UV_VERSION_(MAJOR|MINOR|PATCH) [0-9]+")
foreach(c MAJOR MINOR PATCH)
(defun disable-scroll-bars (frame)
(modify-frame-parameters frame
'((vertical-scroll-bars . nil)
(horizontal-scroll-bars . nil))))
(disable-scroll-bars frame-initial-frame)
(add-hook 'after-make-frame-functions #'disable-scroll-bars)