Skip to content

Instantly share code, notes, and snippets.

def sandbox_import(path, module):
import sys
old = sys.path
sys.path = [path]
oldmod = None
if module in sys.modules:
oldmod = sys.modules[module]
mod = __import__(module)
// Bind F7 to 'step'
javascript:$(document).bind('keydown', function(e) { e.which == 118 && parse('s'); }); void(0)
// Add a 'readhex' command that works just like 'read' but dumps nothing but the hex
javascript:cpu._readhex =
function(e) {
if (!e[1]) return write(" Please give an expression to read the memory at."), void 0;
var t = cpu.to_addr(e[1]);
cpu.get("/cpu/dbg/memory/" + t + "?len=" + (parseInt(e[2], 16) + (15 - parseInt(e[2], 16) & 15) || 32), function(e) {
for (var n = atob(e.raw), i = "", o = " ", s = 0; s < n.length; s++) s % 2 == 0 && (o += " "), o += pad(n.charCodeAt(s).toString(16), 2), s % 8 == 7 && (i += " " + o + "\n", o = " ");
@lunixbochs
lunixbochs / circle.py
Last active August 29, 2015 13:57
Python snippets to create an image alpha mask from a PNG and a PNG from the resulting mask.
import png
mask = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 12, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 135, 252, 255, 255, 255, 251, 134, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
local function string(o)
return '"' .. tostring(o) .. '"'
end
local function recurse(o, indent)
if indent == nil then indent = '' end
local indent2 = indent .. ' '
if type(o) == 'table' then
local s = indent .. '{' .. '\n'
local first = true
SSL_ctrl(): (0 on error, 1 or length otherwise)
SSL_CTX_add_extra_chain_cert
SSL_CTX_set_tmp_ecdh
SSL_set_tlsext_host_name(c.ssl, cname)
0 on error, 1 on success
ASN1_INTEGER_set(C.X509_get_serialNumber(c.x), C.long(serial))
EVP_DecryptUpdate
EVP_EncryptUpdate
EVP_PKEY_assign(key, C.EVP_PKEY_RSA, unsafe.Pointer(rsa))
diff --git a/cert.go b/cert.go
index 0d4a1be..8dc82f8 100644
--- a/cert.go
+++ b/cert.go
@@ -90,7 +90,7 @@ func (n *Name) AddTextEntry(field, value string) error {
defer C.free(unsafe.Pointer(cvalue))
ret := C.X509_NAME_add_entry_by_txt(
n.name, cfield, C.MBSTRING_ASC, cvalue, -1, -1, 0)
- if ret == 0 {
+ if ret != 1 {
@lunixbochs
lunixbochs / calling_conventions.md
Created August 18, 2018 00:47 — forked from yamnikov-oleg/calling_conventions.md
Linux Syscalls Reference

Source: man syscall

Architecture calling conventions

Every architecture has its own way of invoking and passing arguments to the kernel. The details for various architectures are listed in the two tables below.

The first table lists the instruction used to transition to kernel mode, (which might not be the fastest or best way to transition to