Skip to content

Instantly share code, notes, and snippets.

View RaeesBhatti's full-sized avatar

Raees Iqbal RaeesBhatti

View GitHub Profile
@renchap
renchap / README.md
Last active October 12, 2022 17:14
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
@milesj
milesj / gist:1097f6f8a4f7801710e1
Last active April 20, 2020 03:27
HHI Definition Generator
<?php
/**
* This file can be used to generate HHVM/Hack HHI definitions.
* It requires a specific extension to be passed as an argument on the command line.
* It will then loop through all constants, functions, and classes and print accordingly.
*
* For example, to generate HHI definitions for the SPL extension.
*
* php generate.php spl
*
@chluehr
chluehr / toAscii.php
Created January 18, 2012 12:56
PHP clean url slug generator / converter (slug)
<?php
// source: http://cubiq.org/the-perfect-php-clean-url-generator
// author: Matteo Spinelli
// MIT License / http://creativecommons.org/licenses/by-sa/3.0/ (please re-check at source)
setlocale(LC_ALL, 'en_US.UTF8');
function toAscii($str, $replace=array(), $delimiter='-') {
if( !empty($replace) ) {
$str = str_replace((array)$replace, ' ', $str);
}