Skip to content

Instantly share code, notes, and snippets.

View pcan's full-sized avatar
🕳️
down the white rabbit hole

Pierantonio Cangianiello pcan

🕳️
down the white rabbit hole
View GitHub Profile
@pcan
pcan / nodejs-create-environment-method.cc
Created August 24, 2017 14:05 — forked from ghaiklor/nodejs-create-environment-method.cc
NodeJS Create Environment method
Environment* CreateEnvironment(Isolate* isolate, uv_loop_t* loop, Handle<Context> context, int argc, const char* const* argv, int exec_argc, const char* const* exec_argv) {
HandleScope handle_scope(isolate);
Context::Scope context_scope(context);
Environment* env = Environment::New(context, loop);
isolate->SetAutorunMicrotasks(false);
uv_check_init(env->event_loop(), env->immediate_check_handle());
uv_unref(reinterpret_cast<uv_handle_t*>(env->immediate_check_handle()));
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
@pcan
pcan / DynamicServiceActivator.java
Created March 25, 2017 09:13 — forked from arthurtsang/DynamicServiceActivator.java
Create a Spring Integration Channel programatically and register that as a Spring bean
private SubscribableChannel createInputChannel(String inputChannelName) {
PublishSubscribeChannel channel = new PublishSubscribeChannel();
channel.setBeanName(inputChannelName);
channel.setBeanFactory(applicationContext);
//channel.setApplySequence(true);
((ConfigurableApplicationContext)applicationContext).getBeanFactory().registerSingleton(inputChannelName, channel);
return channel;
}
@pcan
pcan / gist:46da4decce64798737a458d5b3c9421c
Created January 17, 2017 21:20 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt