Skip to content

Instantly share code, notes, and snippets.

View diegoos's full-sized avatar
🏠
Working from home

Diego Oliveira diegoos

🏠
Working from home
View GitHub Profile
@diegoos
diegoos / wp-rewrite-rules-table.php
Created January 17, 2021 20:43
Generate table with Wordpress rewrite rules
<?php
function pretty_routes()
{
$wp_rewrite = new WP_Rewrite;
$rules = $wp_rewrite->rewrite_rules();
$table = '<table><tr><th>Route</th><th>Destination</th></tr>';
foreach ($rules as $route => $dest) {
@diegoos
diegoos / add_CA_certificate_ubuntu.md
Last active June 25, 2019 23:20
Make CA Certificate trusted in Ubuntu

Make certificates trusted in Ubuntu

  • Create selfsigned directory on /usr/share/ca-certificates/
  • Copy your company.crt file to the /usr/share/ca-certificates/selfsigned
  • Run sudo dpkg-reconfigure ca-certificates, hit yes to accept all certificates inside ca-certificates folder
  • Search you certificate in the list and press space to select it, after this press enter to add the certificates

Teste with CURL

  • Using curl -I https://youdomain.com before add the certificate you get:
<div id="disqus_thread"></div>
<script>
window.addEventListener('message', receiveMessage, false);
function receiveMessage(event) {
if (event.data) {
var msg;
try {
msg = JSON.parse(event.data);
} catch (err) {
@diegoos
diegoos / sphinx.rb
Created March 6, 2019 16:22 — forked from korny/sphinx.rb
Sphinx Homebrew formula for MySQL 5.7
class Sphinx < Formula
desc "Full-text search engine"
homepage "http://www.sphinxsearch.com"
url "http://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz"
sha256 "6662039f093314f896950519fa781bc87610f926f64b3d349229002f06ac41a9"
head "https://github.com/sphinxsearch/sphinx.git"
bottle do
sha256 "b890cf523db9777c7d125842fd6b0a53fe9a7a5a4cb816389ba6f5ee6483c78d" => :high_sierra
sha256 "55ce34bdedf13946fa614bde50839d93135eae720f1021e2c87807d04515ab18" => :sierra
@diegoos
diegoos / postgres-brew.md
Created February 13, 2019 23:43 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@diegoos
diegoos / Create wildcard Self-Signed Certificate.md
Last active March 20, 2019 21:14 — forked from lucasmartins1994/sshkey.md
Create certificate on localhost

Create a file named openssl.cnf

Put in this file the following code:

[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req

[req_distinguished_name]
@diegoos
diegoos / _readme.md
Last active April 24, 2018 15:02
Script to deploy gh-pages for Vue (Webpack) projects

Setup

Copy the deploy.sh on root of your project.

Deploy

Just run ./deploy.sh

@diegoos
diegoos / ApacheHTTPSConfig.md
Created March 29, 2018 20:53 — forked from nrollr/ApacheHTTPSConfig.md
Enable SSL in Apache for 'localhost' (OSX, El Capitan)

Enable SSL in Apache (OSX)

The following will guide you through the process of enabling SSL on a Apache webserver

  • The instructions have been verified with OSX El Capitan (10.11.2) running Apache 2.4.16
  • The instructions assume you already have a basic Apache configuration enabled on OSX, if this is not the case feel free to consult Gist: "Enable Apache HTTP server (OSX)"

Apache SSL Configuration

Create a directory within /etc/apache2/ using Terminal.app: sudo mkdir /etc/apache2/ssl
Next, generate two host keys:

pages:
stage: deploy
script:
- mkdir .public
- cp -r * .public
- mkdir public
- mv .public public/.public
- cd public
- mv .public HASH_PASSWORD
- wget https://gist.githubusercontent.com/diegoos/a6414c67e5b0c9525385a556c10aa03d/raw/2a96c28318a4419aba0147ff353410b230b4f18e/index.html
@diegoos
diegoos / github_post_recieve.php
Created August 17, 2017 15:29 — forked from youhide/github_post_recieve.php
GitHub PHP webhook to auto-pull on repo push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi