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 / XRDP.md
Last active May 3, 2019 10:42
XRDP Configuration for Xubuntu 16.04

XRDP Configuration for Xubuntu 16.04

This guide includes some content from the official guide "Building on Debian 8", plus some updates.

Prerequisites

Tested on Xubuntu 16.04, fresh install. I'm using xrdp v.0.9.6 in this guide: some adaptations may be necessary for other releases. Since the official guide uses an environment variable during the build, the whole setup should be performed within a single shell console.

Dependencies

@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()));
@pcan
pcan / EventsSample.java
Created May 18, 2017 14:37
Spring 4.2 TransactionalEventListener Test
/*
* **** CREDITS TO: https://github.com/olivergierke/spring-examples *****
*
* Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
// 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 / main.js
Last active April 26, 2017 07:30
NodeJS script for Nexus 3 massive artifact deletion
var server = 'localhost:8081';
var client = new NexusClient(server);
client.login('user', 'password')
.then(() => client.deleteArtifacts('maven-releases', 'it.pcan.test', '0.10.0').then(response => console.log(response.body)))
.then(() => client.deleteArtifacts('maven-releases', 'it.pcan.test', '0.10.1').then(response => console.log(response.body)))
.then(() => client.deleteArtifacts('maven-releases', 'it.pcan.test', '0.10.2').then(response => console.log(response.body)));
@pcan
pcan / README.md
Last active August 6, 2020 07:03
Redis test cluster without ruby

These scripts let you run Redis in cluster mode (only for testing/dev purpose), without using the redis-trib script (written in Ruby! who wants it!?). The create-cluster has been modified to assign cluster slots after creation.

@pcan
pcan / README.md
Created April 3, 2017 09:16
Compile Redis with Cygwin

Prerequisites

Install Cygwin with make, gcc & g++. Download Redis tar.gz package, unpack it.

Patch

Edit deps/hiredis/net.c and add the following lines just after the include directives:

@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 / README.md
Last active April 17, 2024 01:45
Node.js plain TLS Client & Server, 2-way Cert Auth

Node.js TLS plain TLS sockets

This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.

Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.

Prepare certificates

Generate a Certificate Authority:

@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