Skip to content

Instantly share code, notes, and snippets.

@chrisjp
chrisjp / cloudflare_restore_ips.sh
Created October 13, 2023 15:59
A shell script to restore original visitor IPs to Apache/Nginx web servers behind Cloudflare's reverse proxy
#!/bin/bash
# Restore original visitor IPs to your logs
# https://developers.cloudflare.com/support/troubleshooting/restoring-visitor-ips/restoring-original-visitor-ips/
# Conf file locations
CLOUDFLARE_NGINX="/etc/nginx/conf.d/real_ip.conf"
CLOUDFLARE_APACHE="/etc/apache2/conf-available/remoteip.conf"
# Download IP lists (txt files)
IPV4=`curl -s -L https://www.cloudflare.com/ips-v4`
@chrisjp
chrisjp / gist:f24903dfe4f9d1c7f0c9
Last active October 27, 2015 15:20
Useful iOS screen size macros
// Devices
#define ScreenHeight MAX([[UIScreen mainScreen] bounds].size.width,[[UIScreen mainScreen] bounds].size.height)
#define ScreenWidth MIN([[UIScreen mainScreen] bounds].size.width,[[UIScreen mainScreen] bounds].size.height)
#define Screen35in (ScreenHeight==480)
#define Screen40in (ScreenHeight==568)
#define Screen47in (ScreenHeight==667)
#define Screen55in (ScreenHeight==736)
#define iPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define iPadPro ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) && (ScreenHeight==1366))