Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris hinzundcode

View GitHub Profile
View tls-hpkp.js
var tls = require("tls");
var fs = require("fs");
var crypto = require("crypto");
var options = {
host: "test.dev",
port: 8888,
ca: [fs.readFileSync("cert.pem"), fs.readFileSync("cert2.pem")],
};
View gist:5f6e23cf0c02652f7d92
#include <ESP8266WiFi.h>
const char* ssid = "...";
const char* password = "...";
const IPAddress ip(10, 0, 0, 14);
const IPAddress gateway(10, 0, 0, 1);
const IPAddress subnet(255, 255, 0, 0);
const char* host = "10.0.1.1";
const int port = 8889;
View .bashrc
PS1="\[\033[1;31m\]\u\[\033[0m\] in \[\033[1;32m\]\w\[\033[0m\] on \[\033[1;35m\]\h\[\033[0m\]\n$ "
export PS1
@hinzundcode
hinzundcode / Dockerfile
Created Jul 1, 2016
firefox over docker and vnc
View Dockerfile
FROM ubuntu
RUN apt-get update && apt-get install -y x11vnc xvfb firefox
RUN mkdir ~/.vnc
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
RUN bash -c 'echo "firefox"' >> /.bashrc
EXPOSE 5900
CMD ["x11vnc", "-forever", "-usepw", "-create"]
# on osx: $ open vnc://docker:<port>
View gist:4b2f24a3f3c2b1e5113cc73c646380bb
a52dec 0.7.4-9
aalib 1.4rc5-12
acl 2.2.52-2
alsa-firmware 1.0.29-1
alsa-lib 1.1.1-1
alsa-plugins 1.1.1-1
alsa-utils 1.1.1-1
alsaplayer 0.99.81-8
attr 2.4.47-1
autoconf 2.69-3
View AppDelegate.swift
//
// AppDelegate.swift
// Test3
//
// Created by Chris Hinze on 28.05.15.
// Copyright (c) 2015 Chris Hinze. All rights reserved.
//
import Cocoa
@hinzundcode
hinzundcode / libc.js
Created Jan 16, 2018
call execve from nodejs!
View libc.js
const { syscall, getAddress } = require("libsys");
const os = require("os");
if (os.endianess() != "LE")
throw "only little endian supported";
let dontGC = [];
function ref(buffer) {
dontGC.push(buffer);
return getAddress(buffer);
View fork.js
"use strict";
const ffi = require("ffi");
const ref = require("ref");
const ArrayType = require("ref-array");
let StringArray = ArrayType("string");
let voidPtr = ref.refType(ref.types.void);
let stdlib = ffi.Library(null, {
"fork": ["int", []],
View pipe.js
"use strict";
const ffi = require("ffi");
const ref = require("ref");
const ArrayType = require("ref-array");
const { createReadStream, createWriteStream, readSync, writeSync, closeSync } = require("fs");
let IntArray = ArrayType("int");
let StringArray = ArrayType("string");
let voidPtr = ref.refType(ref.types.void);
@hinzundcode
hinzundcode / StringView.js
Created May 5, 2018
read and write strings from arraybuffers
View StringView.js
function strlen(buffer, byteOffset, byteLength) {
let array = new Uint8Array(buffer, byteOffset, byteLength);
for (let i = 0; i < array.length; i++) {
if (array[i] == 0)
return i;
}
throw new Error("invalid string: not ending with null byte");
}