Skip to content

Instantly share code, notes, and snippets.

View ohmydevops's full-sized avatar
🚵‍♀️

Amirhossein Baghaie ohmydevops

🚵‍♀️
View GitHub Profile
@ohmydevops
ohmydevops / 01nginx-tls-sni.md
Created April 16, 2023 22:35 — forked from kekru/01nginx-tls-sni.md
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@ohmydevops
ohmydevops / instagram_scrape.php
Created March 8, 2017 09:16 — forked from cosmocatalano/instagram_scrape.php
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}