Skip to content

Instantly share code, notes, and snippets.

@leandroo
leandroo / LetsEncrypt.md
Last active October 9, 2020 22:43 — forked from davestevens/LetsEncrypt.md
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
<?php
require_once 'vendor/autoload.php';
// Construct transport and client
$transport = new SocketTransport(array('127.0.0.1'),2775);
$transport->setRecvTimeout(60000); // for this example wait up to 60 seconds for data
$smpp = new SmppClient($transport);
// Activate binary hex-output of server interaction
$smpp->debug = true;
#!/usr/bin/env ansible-playbook
- hosts: 127.0.0.1
connection: local
tasks:
- name: Add Docker GPG key
apt_key: url=https://download.docker.com/linux/ubuntu/gpg
- name: Install basic list of packages
apt:
name: ['apt-transport-https','ca-certificates','curl','gnupg-agent','software-properties-common']
require 'yahoo_weatherman'
client = Weatherman::Client.new(:lang => 'pt-br')
response = client.lookup_by_woeid(455823)
puts response.location['city']
puts response.location['region']
puts response.location['country']
puts response.condition['code']
gem install nokogiri
gem install yahoo_weatherman
class Pedido < ActiveRecord::Base
def gera_numero_pedido
record = true
while record
random = "#{Array.new(9){rand(9)}.join}"
record = Pedido.find(:first, :conditions => ["numero = ?", random])
end
self.numero = random
end
var message : Message = new Message();
message.data = " Hello from Merapi Flex.";
message.type = "Reply";
message.send();
/* Adobe Air/Flex - Transformando o componente Image em ByteArray para salvar como tipo BLOB no banco de dados */
private function imageToByteArray(img:Image):ByteArray {
var bmd:BitmapData = new BitmapData(img.width, img.height, true);
bmd.draw(img);
var jpg:JPEGEncoder = new JPEGEncoder();
return jpg.encode(bmd);
}