Skip to content

Instantly share code, notes, and snippets.

Avatar

Levi Durfee levidurfee

View GitHub Profile
@levidurfee
levidurfee / rule-1-for-ajax.txt
Created May 5, 2019
Cloudflare Firewall Rule to Protect WP
View rule-1-for-ajax.txt
if http.request.uri.path contains "/wp-admin/admin-ajax.php"
@levidurfee
levidurfee / rule-2.txt
Created May 4, 2019
Cloudflare Firewall Rule to Protect WP
View rule-2.txt
http.request.uri.path contains "/wp-login.php"
or
http.request.uri.path contains "/wp-admin"
@levidurfee
levidurfee / rule-1.txt
Last active May 4, 2019
Cloudflare Firewall Rules to protect Wordpress
View rule-1.txt
(
ip.src in {2601:2d2:1234:1100::/64}
)
and
(
http.request.uri.path contains "/wp-login.php"
or
http.request.uri.path contains "/wp-admin"
)
View keybase.md

Keybase proof

I hereby claim:

  • I am levidurfee on github.
  • I am ldurfee (https://keybase.io/ldurfee) on keybase.
  • I have a public key ASBY6qZh--demtGpauiVc3PtSY4Kya3rbc0QwfW5HNcUpAo

To claim this, I am signing this object:

@levidurfee
levidurfee / material-design-shadows.css
Created Sep 10, 2018 — forked from serglo/material-design-shadows.css
Google material design elevation system shadows as css. Based on https://material.io/design/environment/elevation.html#default-elevations Exported with Sketchapp from the Google material design theme editor plugin "Baseline" theme.
View material-design-shadows.css
.boxshadow-none { box-shadow: none; }
.boxshadow-1dp { box-shadow: 0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.20); }
.boxshadow-2dp { box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.20); }
.boxshadow-3dp { box-shadow: 0 3px 4px 0 rgba(0,0,0,0.14), 0 3px 3px -2px rgba(0,0,0,0.12), 0 1px 8px 0 rgba(0,0,0,0.20); }
.boxshadow-4dp { box-shadow: 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12), 0 2px 4px -1px rgba(0,0,0,0.20); }
.boxshadow-6dp { box-shadow: 0 6px 10px 0 rgba(0,0,0,0.14), 0 1px 18px 0 rgba(0,0,0,0.12), 0 3px 5px -1px rgba(0,0,0,0.20); }
.boxshadow-8dp { box-shadow: 0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.20); }
.boxshadow-9dp { box-shadow: 0 9px 12px 1px rgba(0,0,0,0.14), 0 3px 16px 2px rgba(0,0,0,0.12), 0 5px 6px -3px rgba(0,0,0,0.20); }
.boxshadow-12dp { box-shadow: 0 12px 17px 2px rgba(0,0,0,0.14), 0 5px 22px 4px rgba(0,0,0,0.12), 0 7px
@levidurfee
levidurfee / worker.js
Created May 25, 2018
Block countries in Europe using Cloudflare Workers
View worker.js
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
const countryCodes = [
'BE', 'BG', 'CZ', 'DK', 'DE', 'EE', 'IE', 'EL', 'ES', 'FR', 'HR', 'IT', 'CY', 'LV', 'LT', 'LU', 'HU', 'MT', 'NL',
'AT', 'PL', 'PT', 'RO', 'SI', 'SK', 'FI', 'SE', 'UK'
];
/**
View htaccess_1
allow from all
deny from 1.2.3.4 # blocks one IP address
deny from 1.3 # blocks every IP beginning with 1.3
View DO server list
<?php
function digitalOcean($DO_API_TOKEN) {
$endpoint = "https://api.digitalocean.com/v2/droplets?per_page=200";
$headers[] = "Content-type: application/json";
$headers[] = "Authorization: Bearer $DO_API_TOKEN";
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $endpoint,
@levidurfee
levidurfee / upload.php
Last active Aug 29, 2018 — forked from taterbase/upload.php
Simple file upload in php
View upload.php
<?php
$message = '';
if(!empty($_FILES['uploaded_file'])) {
$path = 'uploads/';
$path = $path . uniqid('u', true) . '-' . basename($_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
$message = 'The file ' . basename( $_FILES['uploaded_file']['name']) . ' has been uploaded';
} else {
$message = 'There was an error uploading the file, please try again!';
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
input, button {display:block;margin-bottom:10px;}
</style>
</head>
You can’t perform that action at this time.