Skip to content

Instantly share code, notes, and snippets.

View Firesphere's full-sized avatar
🐮
I may be slow to respond.

Simon Erkelens Firesphere

🐮
I may be slow to respond.
View GitHub Profile
#!/bin/bash
res=$(nmap 127.0.0.1 -PN -p ssh | grep open)
curl -s -m 10 --retry 5 --output /dev/null https://healthcheck.io/ping/UUID/start
curl -fsS -m 10 --retry 5 --output /dev/null --data "${res}" https://healthcheck.io/ping/UUID/log
if [[ "${res}" =~ "open" ]]; then
echo "`date` All good" >> /home/pi/ocicheck.log
curl -s -m 10 --retry 5 --output /dev/null https://healthcheck.io/ping/UUID
rm -f /home/pi/awaitingboot
else
@Firesphere
Firesphere / .htaccess
Last active May 14, 2020 08:27
What alignment type is this?
RewriteEngine On
RewriteCond %{REQUEST_URI} !^wp-admin.php
# Anything that has "wp-" in its request, will be send to the bomb
RewriteRule ^(.*)wp-(.*)$ wp-admin.php [L]
@Firesphere
Firesphere / LoginAttemptExtension.php
Created August 19, 2019 21:42
Adding last login recording
<?php
namespace App\Extensions;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Security\LoginAttempt;
/**
*
* @property LoginAttempt|LoginAttemptExtension $owner
@Firesphere
Firesphere / MyPage.ss
Last active December 5, 2018 06:03
Page Controller
<% if $Messages.Count %>
<% loop $Messages %>
<% include Message isSearch=$Top.isSearch %>
<% end_loop %>
<% end_if %>
$suffixes = $result->getBody();
$count = 0;
$shaEnd = strtoupper($shaEnd);
$suffixes = explode("\r\n", $suffixes);
foreach ($suffixes as $suffix) {
list($suffix, $pwnCount) = explode(':', $suffix);
if ($suffix === $shaEnd) {
$count += (int)$pwnCount;
}
}
<?php
namespace Firesphere\Persona\Elements;
use All\The\Persona\things;
class PersonaElement extends ElementContent
{
private static $has_one = [
'Persona' => Persona::class
class MainApplicationFormStep1 extends MultiFormStep
{
public static $next_steps = 'MainApplicationFormStep2';
public function getFields() {
return FieldList::create(
$name = TextField::create('FirstName', 'First name', 'spazz', '180'),
$surname = TextField::create('Surname', 'Surname')
);
@Firesphere
Firesphere / Category.php
Last active September 15, 2017 03:27
Permission managed via the Security menu
<?php
/**
* Class Category
*
* @property string $Title
* @property string $CMSSummary
*/
class Category extends DataObject implements PermissionProvider
{
class PageTest extends SapphireTest
{
protected static $fixture_file = 'PageTest.yml';
public function setUp()
{
parent::setUp();
$this->page = $this->objFromFixture('Page', 'TestPage');
$this->page->doPublish();
}
@Firesphere
Firesphere / composer.json
Last active June 8, 2017 19:40
Try the new and improved Authentication flow yourself
{
"name": "silverstripe/installer",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.6",
"silverstripe/cms": "dev-authenticator-refactor as 4.0.x-dev",
"silverstripe/framework": "dev-authenticator-refactor as 4.0.x-dev",
"silverstripe/reports": "dev-authenticator_refactor as 4.0.x-dev",
"silverstripe/siteconfig": "dev-authenticator_refactor as 4.0.x-dev",
"silverstripe/versioned": "dev-authenticator_refactor as 1@dev",