Skip to content

Instantly share code, notes, and snippets.

View campezzi's full-sized avatar

Thiago Campezzi campezzi

  • EQL
  • Mellbourne, Australia
  • 22:43 (UTC +11:00)
  • X @tcampezzi
View GitHub Profile
@campezzi
campezzi / ghci.conf
Created May 29, 2017 09:11
GHCI - Bold Cyan Lambda Prompt
:set prompt "\ESC[1;36mλ> \ESC[m"
@campezzi
campezzi / server.js
Created October 20, 2017 04:58
CORS Bypass Proxy
const express = require('express');
const proxy = require('express-http-proxy');
const cors = require('cors');
const app = express();
app.use(cors());
app.use('/', proxy('http://target-server.com'));
app.listen(3005);
@campezzi
campezzi / Howto convert a PFX to a seperate .key & .crt file
Created December 12, 2018 06:17 — forked from TemporaryJam/Howto convert a PFX to a seperate .key & .crt file
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
@campezzi
campezzi / Application.ex
Last active January 17, 2019 01:54
Elixir - Using GenStage's ConsumerSupervisor to have a dynamic pool of consumer processes
defmodule MyApp.Application do
use Application
def start(_type, _args) do
children = [
Supervisor.Spec.worker(Producer, []),
Supervisor.Spec.worker(Consumer, [], id: 1)
]
opts = [strategy: :one_for_one, name: Stages.Supervisor]
@campezzi
campezzi / 0-Agenda.md
Last active November 8, 2019 03:24
Refactoring
  • About me
  • The world's fastest explanation of refactoring
  • Some examples of refactoring from real-life applications
  • Hairier examples of refactoring from real-life applications
  • My refactoring algorithm
  • Open mic