Skip to content

Instantly share code, notes, and snippets.

@dereckson
dereckson / FingerClient.php
Created Sep 18, 2013
Finger client in PHP.
View FingerClient.php
<?php
/**
* Finger client
*/
class FingerClient {
/**
* The finger remote server
* @var string
*/
@dereckson
dereckson / step1.js
Last active Oct 1, 2020
Regenerate DockerHubBuildTriggers.json
View step1.js
triggers = {};
(function () {
var s = document.createElement('script');
s.setAttribute('src', 'https://code.jquery.com/jquery-3.5.1.min.js');
document.body.appendChild(s);
}());
// Pause as we need jQuery object to be available, and so we need to let time to the browser to load the script
@dereckson
dereckson / salt.patch
Last active Nov 1, 2019
Allow cmd.* to work on FreeBSD with runas
View salt.patch
--- modules/cmdmod.py.old 2019-10-30 13:41:23.087222000 +0000
+++ modules/cmdmod.py 2019-10-30 20:00:37.064300000 +0000
@@ -67,9 +67,7 @@
# Set up logging
log = logging.getLogger(__name__)
-DEFAULT_SHELL = salt.grains.extra.shell()['shell']
-
# Overwriting the cmd python module makes debugging modules with pdb a bit
@dereckson
dereckson / app.rs
Created Sep 5, 2018
Example to run a Rocket server to serve some routes through Limiting Factor.
View app.rs
use limiting_factor::kernel::DefaultApplication;
use requests::*;
pub fn run () {
let routes = routes![
status,
favicon,
users::register,
users::get_player,
];
@dereckson
dereckson / product.php
Created Mar 19, 2018
How to perform 14 * 10^-15?
View product.php
<?php
use Brick\Math\BigDecimal;
require 'vendor/autoload.php';
$left = BigDecimal::of(14);
$right = BigDecimal::one()->toScale(15)->dividedBy(BigDecimal::ten()->power(15));
$product = $left->multipliedBy($right);
@dereckson
dereckson / app.js
Created Mar 20, 2017
Code to parse a JSON document, decorate with relevant links and print a server log
View app.js
"use strict";
/* -------------------------------------------------------------
Nasqueron infrastructure
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Project: Nasqueron
Author: Sébastien Santoro aka Dereckson
Dependencies: jQuery
Filename: app.js
Licence: CC-BY 4.0, MIT, BSD-2-Clause (multi-licensing)
@dereckson
dereckson / proof.md
Last active Nov 20, 2016
Keybase proof
View proof.md

Keybase proof [36/90]

I hereby claim:

  • I am dereckson on github.
  • I am dereckson (https://keybase.io/dereckson) on keybase.
  • I have a public key whose fingerprint is 1E16 E1A7 0417 6257 76FA 944D 34A4 3097 536F 1E8D

To claim this, I am signing this object:

View gist:e4d184599de177f8a57539df59ae0889
Verifying that +dereckson is my blockchain ID. https://onename.com/dereckson
View QuestionMark.js
/* -------------------------------------------------------------
Keyboard shorcuts help
Based on QuestionMark.js by Louis Lazaris
http://impressivewebs.github.io/QuestionMark.js/
CC-BY 2.0 license with additional waiver 'no credit required'
Port to Dojo 1.9 by Dereckson
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
@dereckson
dereckson / ForcePurgeAction
Created Jan 2, 2013
Allows MediaWiki to force purge for anonymous requests, with ?action=purge&forcepurge=1. This is intended to be used when generating links webcrawlers shouldn't get.
View ForcePurgeAction
diff --git a/includes/actions/PurgeAction.php b/includes/actions/PurgeAction.php
index cd58889..5a8cc6f 100644
--- a/includes/actions/PurgeAction.php
+++ b/includes/actions/PurgeAction.php
@@ -61,7 +61,8 @@ class PurgeAction extends FormAction {
// This will throw exceptions if there's a problem
$this->checkCanExecute( $this->getUser() );
- if ( $this->getUser()->isAllowed( 'purge' ) ) {
+ $forcePurge = isset( $_GET['forcepurge'] ) && ( $_GET['forcepurge'] == 1 );