Skip to content

Instantly share code, notes, and snippets.

View tiomoreno's full-sized avatar
🎯
Focusing

Tio Moreno tiomoreno

🎯
Focusing
View GitHub Profile
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
module Jekyll
require 'coffee-script'
class CoffeeScriptConverter < Converter
safe true
priority :normal
def matches(ext)
ext =~ /coffee/i
end

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

@tiomoreno
tiomoreno / EmailWorkerCommand.php
Last active December 18, 2015 18:29
Gearman worker para envio de email
<?php
namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
// middleware
app.use(express.bodyParser({ keepExtensions: true, uploadDir: __dirname + "/public/uploads" }))
// later
app.get('/photos', uploadFile, addPhoto)
// file is automatically saved to /public/uploads, let's just set
function uploadFile(req, res, next) {
if (req.files) {
req.body.url = "http://myawesomesite.com/" + req.files.file.path.split("/").slice(-2).join("/")
{
"cmd": ["g++", "$file", "-o", "$file_base_name", "-I/usr/local/include"],
"selector": "source.c++",
"windows":
{
"cmd": ["cl", "/Fo${file_path}", "/O2", "$file"]
}
}
@tiomoreno
tiomoreno / udev.sh
Created May 8, 2013 17:50
Instala regra udev para reconhecimento de aparelhos android no linux
UDEV_RULE_PATH="/etc/udev/rules.d/51-android.rules"
ANDROID_RULE='SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"'
instala_regra_udev() {
echo $ANDROID_RULE >> $UDEV_RULE_PATH
sudo udevadm control --reload-rules
echo "Driver instalado com sucesso!"
}
if [ -f "$UDEV_RULE_PATH" ]
@tiomoreno
tiomoreno / minify.py
Last active December 16, 2015 12:58
Ferramenta para minificar arquivos javascript e css usando o YUI Compressor
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Tool for minifing static files with yui compressor
"""
import os
from subprocess import call
from optparse import OptionParser
# Add this config
$ heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib
# Login to Heroku CLI
$ heroku run bash
# The second argument here is the path to your script
~ $ ~/php/bin/php -f ~/www/index.php
<?php
ini_set('memory_limit', '512M');
ini_set('date.timezone', "America/Sao_paulo");
require_once 'PdoFactory.php';
require_once 'Metadata.php';
$config = include_once 'config/cron_config.php';
function logsNulos($database)