Skip to content

Instantly share code, notes, and snippets.

View gabrielschulhof's full-sized avatar

Gabriel Schulhof gabrielschulhof

  • California, USA
View GitHub Profile
#include <gtk/gtk.h>
int main(int argc, char *argv[]) {
GtkWidget *view;
GtkTextBuffer *buffer;
GtkWidget *window;
GdkDisplay *display;
GdkScreen *screen;
GtkCssProvider *provider;
# Script to be used with gdb to trace changes to the maps file as Node.js
# performs mmaps.
import io
import os
import sys
import gdb
import shutil
import subprocess
set pagination off
set breakpoint pending on
set style enabled off
set environment NODE_ENV=production
define domaps
shell echo "*** Start Event ***"
bt 10
python gdb.execute('finish');
shell echo "*** End Event *****"
continue
class FinishMapsBreak (gdb.FinishBreakpoint):
def stop(self):
gdb.write('----------- End Event ------------\n')
gdb.flush()
return False
def out_of_scope(self):
return self.stop()
class MapsBreak (gdb.Breakpoint):
We couldn’t find that file to show.

| Parent Class | Subclasses | |---|---|---| | | [Napi::Boolean][], [Napi::Number][], |

> const x = new Error();
undefined
> const vm = require('vm');
undefined
> vm.runInNewContext;
[Function: runInNewContext]
> vm.runInNewContext('x instanceof Error');
Thrown:
evalmachine.<anonymous>:1
x instanceof Error
@gabrielschulhof
gabrielschulhof / addon.js
Created June 27, 2019 17:02
Send modules to native
const addon = require('bindings')('addon');
addon.receiveModule('fs', require('fs'));
addon.receiveModule('crypto', require('crypto'));
console.log(addon.sendModule('fs') === require('fs'));
console.log(addon.sendModule('crypto') === require('crypto'));
host mac-node-ci
Hostname 207.254.58.162
Port 10005
User administrator
Cipher aes128-ctr
#include <stdio.h>
template <int x_init, int y_init>
class HasStructures {
public:
struct InnerStruct {
InnerStruct(): x(x_init), y(y_init) {}
int x;
int y;
};