Skip to content

Instantly share code, notes, and snippets.

@ivanh
ivanh / openssl_encrypt_decrypt.php
Created November 19, 2018 10:28 — forked from joashp/openssl_encrypt_decrypt.php
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@ivanh
ivanh / letsencrypt_2018.md
Created September 15, 2018 22:58 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@ivanh
ivanh / index.php
Created October 8, 2017 10:39 — forked from xeoncross/index.php
Tiny, SMTP client in PHP
<?php
/*
This is a very tiny proof-of-concept SMTP client. Currently it's over 320 characters (if the var names are compressed). Think you can build one smaller?
*/
ini_set('default_socket_timeout', 3);
$user = '[email protected]';
$pass = '';
$host = 'ssl://smtp.gmail.com';
@ivanh
ivanh / migrate-legacy-mailcow-to-dockerized.sh
Created October 7, 2017 17:43 — forked from janxb/migrate-legacy-mailcow-to-dockerized.sh
This Scripts migrates a legacy mailcow instance to a new mailcow.dockerized one. Domains, Users, SOGo-Settings, Forwardings and Mails are migrated.
#!/bin/bash
set -e
cd ~/mailcow-dockerized
DBUSER=mailcow
DBPASS=xxxxxxxxxxxxxxxxxxxx
DBNAME=mailcow
DBHOST=mailcow.lxd
@ivanh
ivanh / Documentation.md
Created December 1, 2016 01:49 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs