Skip to content

Instantly share code, notes, and snippets.

View levidurfee's full-sized avatar

Levi Durfee levidurfee

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>hi world!</title>
</head>
<body>
<p>It is me, a gist iframe in AMP!</p>
</body>
</html>
@levidurfee
levidurfee / Greeter.ts
Last active April 25, 2017 00:06
Gist with multiple files, different languages, and more code
class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
node_modules/
.env
@levidurfee
levidurfee / README.md
Last active July 11, 2017 22:55
Help me, please.
gcc hash.c -o hash -lcrypto -lssl -Wall
./hash
@levidurfee
levidurfee / miner.c
Last active July 14, 2017 17:15
openmp
/*L****************************************************************************
* FILENAME: hash.c VERSION: 0.5.0
*
* DESCRIPTION: SHA512 Miner example
*
* AUTHOR: Levi Durfee DATE: 20170714
*
* CHANGES
* ----------------------------------------------------------------------------
* REF NO VERSION DATE WHO NOTES
<!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>
<?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 / htaccess_1
Last active February 21, 2018 00:05
htaccess
allow from all
deny from 1.2.3.4 # blocks one IP address
deny from 1.3 # blocks every IP beginning with 1.3
@levidurfee
levidurfee / worker.js
Created May 25, 2018 21:05
Block countries in Europe using Cloudflare Workers
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'
];
/**
@levidurfee
levidurfee / upload.php
Last active August 29, 2018 18:25 — forked from taterbase/upload.php
Simple file upload in 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!';