Skip to content

Instantly share code, notes, and snippets.

View devjoca's full-sized avatar
🤠
One more day in peruvialand

Joca devjoca

🤠
One more day in peruvialand
View GitHub Profile
@devjoca
devjoca / server_certificates_to_pem.md
Created May 5, 2020 04:41 — forked from stevenhaddox/server_certificates_to_pem.md
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample

@devjoca
devjoca / server_certificates_to_pem.md
Created May 5, 2020 04:41 — forked from stevenhaddox/server_certificates_to_pem.md
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample

@devjoca
devjoca / gitlab_dag_diagram.py
Created February 17, 2020 19:18 — forked from aarongorka/gitlab_dag_diagram.py
Prints a PlantUML diagram that shows the DAG of the GitLab pipeline
#!/usr/bin/env python3
"""Prints a PlantUML diagram that shows the DAG of the GitLab pipeline"""
import sys
import yaml
from pprint import pprint
def merge(user, default):
if isinstance(user,dict) and isinstance(default,dict):
for k,v in default.items():
@devjoca
devjoca / gitlab_dag_diagram.py
Created February 17, 2020 19:18 — forked from aarongorka/gitlab_dag_diagram.py
Prints a PlantUML diagram that shows the DAG of the GitLab pipeline
#!/usr/bin/env python3
"""Prints a PlantUML diagram that shows the DAG of the GitLab pipeline"""
import sys
import yaml
from pprint import pprint
def merge(user, default):
if isinstance(user,dict) and isinstance(default,dict):
for k,v in default.items():
@devjoca
devjoca / Start pm2 process
Created March 4, 2019 19:14 — forked from gianlucacandiotti/Start pm2 process
Starts pm2 process using specified npm script
pm2 start npm --name "NAME" -- run script-name
sudo kill `sudo lsof -t -i:9001`
@devjoca
devjoca / System Design.md
Created April 18, 2016 16:32 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@devjoca
devjoca / GIF-Screencast-OSX.md
Created March 22, 2016 04:52 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@devjoca
devjoca / php5.6-pgsql.Dockerfile
Created February 16, 2016 21:29 — forked from ben-albon/php5.6-pgsql.Dockerfile
Docker PHP Image with PostgreSQL Driver
FROM php:5.6-apache
RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql
COPY src/ /var/www/html
@devjoca
devjoca / gist:c37128b755bd5b1c2115
Created February 2, 2016 23:13 — forked from Thordin/gist:ecaa462a82fe9e2d59da
C++ std::string trim whitespace
void rtrim(std::string& str) {
size_t endpos = str.find_last_not_of(" \t\r\n");
if(std::string::npos != endpos )
str = str.substr(0, endpos+1);
}
void ltrim(std::string& str) {
size_t startpos = str.find_first_not_of(" \t\r\n");
if(std::string::npos != startpos )
str = str.substr(startpos);