This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// API endpoint | |
$api = 'example.com/api_call'; | |
// Parse uri segments | |
function uri(int $n) | |
{ | |
$n++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Download latest version of gitea | |
export LATEST=$(curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest | grep 'browser_download_url' | cut -d\" -f4 | grep 'linux-amd64' | grep -v .asc | grep -v .xz | grep -v .sha256) | |
wget -O gitea $LATEST | |
# Create user | |
echo "Creating git user" | |
adduser \ | |
--system \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function CliCheck() | |
{ | |
if (defined('STDIN')) return true; | |
if (php_sap_name() === 'cli') return true; | |
if (array_key_exists('SHELL', $_ENV)) return true; | |
if ( | |
empty($_SERVER['REMOTE_ADDR']) && | |
! isset($_SERVER['HTTP_USER_AGENT']) && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ls -l | awk '{ | |
k = 0 | |
s = 0 | |
for( i = 0; i <= 8; i++ ) | |
{ | |
k += ( ( substr( $1, i+2, 1 ) ~ /[rwxst]/ ) * 2 ^( 8 - i ) ) | |
} | |
j = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Auth | |
* | |
* Verifies authentication credentials | |
* | |
* @author Mark LaDoux <mark.ladoux@gmail.com> | |
*/ | |
class Auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ls -l | awk '{ | |
k = 0 | |
s = 0 | |
for( i = 0; i <= 8; i++ ) | |
{ | |
k += ( ( substr( $1, i+2, 1 ) ~ /[rwxst]/ ) * 2 ^( 8 - i ) ) | |
} | |
j = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Monokai color Scheme Syntax Highlight Overrides ( REQUIRES 'body' TAGS TO WORK) */ | |
body .gist .highlight { | |
background: #272822; | |
} | |
body .gist .blob-num, | |
body .gist .blob-code-inner, | |
body .gist .pl-s2, | |
body .gist .pl-stj { | |
color: #f8f8f2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Set width to 600px, and center box */ | |
.gist { | |
margin-left: auto; | |
margin-right: auto; | |
width: 600px !important; | |
} | |
/* Limit height and width of script box, and enable scrollbars */ | |
.gist-data { | |
height:250px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace DHMedia\Input; | |
/** | |
* DHMedia URI Parser | |
* | |
* @author Mark LaDoux <mark.ladoux@gmail.com> | |
* @copyright Copyright © 2018, DoomHamster Media | |
* @license MIT <https://opensource.org/licenses/MIT> | |
*/ | |
class URI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enforce HTTPS | |
$app->add(function (Request $request, Response $response, $next) { | |
$cf = $this->get('settings'); | |
// Check if configuration wants us to enforce https, so we can turn it | |
// on or off depending on whether the server supports https | |
if (isset($cf['force_https']) && $cf['force_https'] === true) { | |
if ($request->getUri()->getScheme() !== 'https') { | |
// Redirect to HTTPS |
NewerOlder