Skip to content

Instantly share code, notes, and snippets.

View thlorenz's full-sized avatar
👁️
{ this.props.status }

Thorsten Lorenz thlorenz

👁️
{ this.props.status }
View GitHub Profile
@thlorenz
thlorenz / clean-dupes.js
Created February 22, 2017 19:27
Remove duplicate files found inside one directory
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
function bySizeThenByName(a, b) {
if (a.size === b.size) {
return a.path.localeCompare(b)
}
return a.size < b.size
@thlorenz
thlorenz / collaborating.md
Last active September 20, 2022 18:20
A quick guideline to contributing to my open source projects

Collaborator Guidelines

Now where you are a collaborator you have certain powers that you should use carefully, so I'm listing some guidelines here.

Contributing

Proposing a Change

Even though as a contributor you could push directly to master, please don't do that. Instead each bug fix or feature

@thlorenz
thlorenz / update_to_nan_v2.0.x.sh
Last active October 13, 2016 08:04
Script to update Node.js addons to work with nan 2.0.x and thus with iojs v3.x (gets you 90% there)
#!/bin/bash
replacements=(
"NanAsyncWorker/Nan::AsyncWorker"
"NanAsyncQueueWorker/Nan::AsyncQueueWorker"
"NanCallback/Nan::Callback"
"NanSetInternalFieldPointer/Nan::SetInternalFieldPointer"
"NanGetInternalFieldPointer/Nan::GetInternalFieldPointer"
"NanNewBufferHandle\\(([^;]+);/Nan::NewBuffer(\\1.ToLocalChecked();"
"(NanNew(<(v8::)?String>)?\\(\"[^\"]*\"\\))/\\1.ToLocalChecked()"
@thlorenz
thlorenz / Copy Netflix List.md
Last active August 29, 2015 14:26
Copy Netflix List sorted by title to Clipboard
  1. Go to My List
  2. Open DevTools
  3. Paste the below code into the console
  4. Hit Enter
  5. Your list is in your clipboard sorted by title
var cards = document.getElementsByClassName("smallTitleCard"), s = [], title;
for (var i = 0; i < cards.length; i++) {
 title = cards.item(i).attributes.getNamedItem('aria-label').textContent;
@thlorenz
thlorenz / autostep-gdb.md
Last active October 16, 2019 09:25
gdb: automatically step through a binary one instruction at a time and log registers at each step

gdbinit

set disassemble-next-line on
set dissasembly-flavor intel

b _start
run

while 1
@thlorenz
thlorenz / v8-project.md
Last active August 29, 2015 14:18
Get complete v8 Project

Steps to checkout v8 source and initialize it properly. This includes tests, d8 and example projects.

## get source and initialize dependencies
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git && cd depot_tools
export PATH=`pwd`:$PATH

cd ../
mkdir v8_checkout &amp;&amp; cd v8_checkout
@thlorenz
thlorenz / scriptie-talkie-flags.md
Created March 31, 2015 19:12
Outlines how binary flags work.

Scriptie Talkie Log

In case this doesn't work in your browser.

Outlines how binary flags work.

Script

var alive = parseInt('0001', 2);
@thlorenz
thlorenz / steps-lldb-jit-on-osx.md
Last active April 21, 2021 09:56
lldb JIT on OSX (showing no useful info at this point)

Installation

Ninja

  • needed for faster Node.js builds
brew install ninja
@thlorenz
thlorenz / Reusing Errors vs. creating new Error with stack attached.md
Last active August 26, 2018 15:12
Reusing Errors vs. creating new Error with stack attached

It is not usually recommended to reuse errors since the stack trace is attached whenever the error is instantiated.

However in some cases the overhead of doing that may affect performance, especially if the error is an exception that is known to occur frequently and is handled.

Only in these cases it may be advantagous to reuse the created Error. In all other cases getting a full stacktrace created at the time the exception occurs is to be preferred as it gives much better information needed to debug the problem.

Run

➝ node errors.js