Skip to content

Instantly share code, notes, and snippets.

View lukaskollmer's full-sized avatar
👻
procrastinating

Lukas Kollmer lukaskollmer

👻
procrastinating
View GitHub Profile
@lukaskollmer
lukaskollmer / ref-buffer-type.js
Created January 2, 2019 15:24 — forked from TooTallNate/ref-buffer-type.js
Fixed length "Buffer" type, for use in `ref-struct` type definitions.
var ref = require('ref');
module.exports = BufferType;
/**
* Fixed length "Buffer" type, for use in Struct type definitions.
*
* Optionally setting the `encoding` param will force to call
* `toString(encoding)` on the buffer returning a String instead.
*/
// https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzab6/poll.htm
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <errno.h>
//
// server.c
// exercise-08
//
// Created by Lukas Kollmer on 2018-12-12.
// Copyright © 2018 Lukas Kollmer. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
const replaceAll = (target, pattern, replacement) => {
return target.replace(new RegExp(pattern, 'g'), replacement);
};
const filterHdUrl = urls => {
for (const url of urls) {
if (url.label === 'HD') return url;
}
return urls[1];
};
@lukaskollmer
lukaskollmer / get-urls.js
Created September 23, 2018 15:30
Extract download urls from archives.gov
// Extracts the download urls from a table of links to files
// 1. run the script below in your browser's console
// 2. copy the printed urls, save to text file
// 3. `wget -i YOUR_TEXT_FILE`
const main = document.getElementById('block-system-main');
const table = main.children[main.children.length - 1].children[0].children[0];
const rows = Array.from(table.children[0].children)
rows.splice(0, 1)
console.log(rows.map(row => row.children[0].children[0].href).join('\n'));
let libobjc = dlopen("/usr/lib/libobjc.A.dylib", RTLD_LAZY)!
let i_objc_getClass = FFIFunctionInvocation(symbol: "objc_getClass", handle: libobjc, returnType: .pointer, parameterTypes: [.pointer])
/*do {
let NSProcessInfo_text = "NSProcessInfo".utf8CString
var arg0: UnsafePointer<CChar>!
NSProcessInfo_text.withUnsafeBufferPointer {
arg0 = $0.baseAddress!
[yo:info]
[0000] push __INVOKING_ALL_STATIC_INITIALIZERS__
[0001] call 0
[0002] pop 0
[0003] push main
[0004] noop 0
[0005] _s11<%s-%nh>:
[0006] noop 8
[0007] noop 60
[0008] noop 37
[yo:info]
[0000] push __INVOKING_ALL_STATIC_INITIALIZERS__
[0001] call 0
[0002] pop 0
[0003] push main
[0004] noop 0
[0005] _s11<%s-%nh>:
[0006] noop 8
[0007] noop 60
[0008] noop 37
[yo:info]
[0000] push __INVOKING_ALL_STATIC_INITIALIZERS__
[0001] call 0
[0002] pop 0
[0003] push main
[0004] noop 0
[0005] _s14vtable:
[0006] noop 6
[0007] noop 118
[0008] noop 116
[yo:info]
[0000] push __INVOKING_ALL_STATIC_INITIALIZERS__
[0001] call 0
[0002] pop 0
[0003] push main
[0004] noop 0
[0005] _s11<%s-%nh>:
[0006] noop 8
[0007] noop 60
[0008] noop 37