Skip to content

Instantly share code, notes, and snippets.

View skanjo's full-sized avatar

Samer Kanjo skanjo

View GitHub Profile
@skanjo
skanjo / Howto convert a PFX to a seperate .key & .crt file
Last active January 29, 2016 16:58 — 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]`
@skanjo
skanjo / godaddy-ssl-howto
Created January 29, 2016 17:09 — forked from ideaoforder/godaddy-ssl-howto
GoDaddy + Nginx SSL
openssl req -new -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr
http://support.godaddy.com/help/article/3601/generating-a-certificate-signing-request-nginx
http://support.godaddy.com/help/article/4976/rekeying-an-ssl-certificate
# Be sure to remember to chain them!
cat gd_bundle-g2-g1.crt >> yourdomain.crt
# Move 'em
sudo mv yourdomain.crt /etc/ssl/certs/yourdomain.crt
@skanjo
skanjo / instal_oracle_java_on_ubuntu.md
Last active February 2, 2016 04:23
Install Oracle Java on Ubuntu 14.04

Get Oracle java tarball

cd ~
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u71-b15/jdk-8u71-linux-x64.tar.gz"

Make install directory

sudo mkdir /opt/jdk
@skanjo
skanjo / nginx.conf
Created February 14, 2016 02:16 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@skanjo
skanjo / ClassLoaderLeakExample.java
Created May 12, 2016 16:21 — forked from dpryden/ClassLoaderLeakExample.java
Example of a ClassLoader leak in Java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,
@skanjo
skanjo / java.env
Created August 30, 2016 20:47 — forked from rosstimson/java.env
Init Script (RHEL, CentOS) for ZooKeeper + optional configs (assumes zookeeper tarball extracted to /opt/zookeeper)
# /opt/zookeeper/conf/java.env
ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
ZOO_LOG_DIR="/var/log/zookeeper/"
@skanjo
skanjo / java.env
Created August 30, 2016 21:07 — forked from equalize/java.env
ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
ZOO_LOG_DIR="/var/log/zookeeper/"
@skanjo
skanjo / _etc_systemd_system_kafka.service
Created August 31, 2016 17:48 — forked from Radamanf/_etc_systemd_system_kafka.service
Kafka daemon with System.d. You also can use bin/kafka for init.d. Just unzip ZooKeeper and Kafka to you home/user/soft/ dir and create listed three files then enable them to be autostarted by systemctl enable kafka.service and systemctl enable zookeeper.service.
[Unit]
Description=Apache Kafka server (broker)
Documentation=http://kafka.apache.org/documentation.html
Requires=zookeeper.service network.target remote-fs.target
After=zookeeper.service network.target remote-fs.target
[Service]
Type=forking
PIDFile=/var/run/kafka.pid
ExecStart=/home/user/bin/kafka start
@skanjo
skanjo / gist:9ac74aa59c838424b47ffd1facd8c0fe
Created October 22, 2017 00:28 — forked from InfoSec812/gist:a45eb3b7ba9d4b2a9b94
SSL Config Example For Vert.x 3.0.0
package com.zanclus.socialshell;
import com.zanclus.socialshell.utils.AbstractLoggingVerticle;
import static io.vertx.ext.auth.shiro.LDAPAuthRealmConstants.*;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Verticle;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.core.json.JsonObject;
@skanjo
skanjo / install-maven-centos.md
Last active March 8, 2018 16:27
Install Apache Maven on CentOS

For the latest download link check the Apache Maven download page:

https://maven.apache.org/download.cgi

Download Apache Maven

cd~
wget "http://mirror.sdunix.com/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz"

Create directory and install