Skip to content

Instantly share code, notes, and snippets.

@richardbenson
richardbenson / RestoreCryptolockerFiles.vbs
Created October 15, 2013 19:42
Dirty script knocked together to recover from a CryptoLocker infection. So you don't have to roll-back unaffected files: * Restore back to a separate folder * Amend first two lines as follows: * `strRestoreFolder` is the folder you restored from backuup * `strOriginalFolder` is your destroyed store * Highly recommend a test run by leaving `bolDo…
strRestoreFolder = "G:\Document"
strOriginalFolder = "E:\Document"
bolDoIt = false
strAffectedFiles = "odt, ods, odp, odm, odc, odb, doc, docx, docm, wps, xls, xlsx, xlsm, xlsb, xlk, ppt, pptx, pptm, mdb, accdb, pst, dwg, dxf, dxg, wpd, rtf, wb2, mdf, dbf, psd, pdd, eps, ai, indd, cdr, jpg, jpe, jpg, dng, 3fr, arw, srf, sr2, bay, crw, cr2, dcr, kdc, erf, mef, mrw, nef, nrw, orf, raf, raw, rwl, rw2, r3d, ptx, pef, srw, x3f, der, cer, crt, pem, pfx, p12, p7b, p7c, pdf, tif"
arrAffectedFiles = Split(arrAffectedFiles, ", ")
Set dicAffectedFiles = CreateObject("Scripting.Dictionary")
@richardbenson
richardbenson / sns-pushover.php
Last active September 30, 2018 10:35
Simple script to send SNS notifications to your smartphone via Pushover. Requires signing up for Pushover and getting an API key. Then host anywhere and add the URL as subscription to your topic.
<?php
define('PUSHOVER_API_KEY', '<API KEY>'); //Replace with your API Key
$userKey = (isset($_GET['u']) ? $_GET['u'] : '<DEFAULT USER ID>'); //Default user or group
$response = json_decode(file_get_contents('php://input'), true);
switch ($response["Type"]) {
case "SubscriptionConfirmation":
//For this use case, we will just automatically subscribe, we could forward this via email,
@richardbenson
richardbenson / xmlrpc.php
Last active October 13, 2015 15:38
ifttt to movabletype
<?php
//Variables, set these
$xmlrpc_fullurl = "http://www.example.com/cgi-bin/mt/mt-xmlrpc.cgi"; // path to your mt-xmlrpc.cgi file
$blog_id = "3"; //The blog ID to post to, as IFTTT has no options for this we force it.
//Fetch the request and turn it into an XML element for editing
$request_body = file_get_contents('php://input');
$methodCall = new SimpleXMLElement($request_body);
//Check if the title includes a blog id in the form "title {x}"
@richardbenson
richardbenson / get-steam-screenshots.php
Last active August 11, 2023 17:26
Turn Steam screenshots into RSS feed
<?php
header("Content-Type: application/rss+xml; charset=utf-8");
error_reporting(E_ALL);
ini_set("display_errors", 0);
define('STEAM_USER', $_GET['u']);
define('LIST_URL', "http://steamcommunity.com/id/".STEAM_USER."/screenshots/?appid=0&sort=newestfirst&browsefilter=myfiles&view=grid");
include('extlib/ganon/ganon.php');
@richardbenson
richardbenson / loadtest.sh
Created February 24, 2012 13:57
Script beeswithmachineguns
#!/bin/sh
REQUESTS=10000
COUNT=250
BEES=4
KEYNAME=<whateveryourkey.pem is>
GROUP=public
while getopts "h:r:c:b:" opt; do
case $opt in
@richardbenson
richardbenson / div.html
Created February 8, 2012 16:06
YAMS pop-in
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="jquery.cookie.js"></script>
<div id="other-yams">
<div id="oy-close">X</div>
<h3>Got the right YAMS?</h3>
<div id="oy-text">This is the site for YAMS, a tool to make running your own Minecraft server as easy as possible.<br />
Looking to play on the family friendly public Minecraft server "<a href="http://www.darrenstraight.com/minecraft.php" target="_blank">Yet Another Minecraft Server</a>"?</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
@richardbenson
richardbenson / gist:1447457
Created December 8, 2011 16:11
Specify as many or as few options as you go
$.ajaxSetup({
url: '/api/',
type: 'POST',
dataType: 'json'
});
//------ e.g. 1, just need to specify data
$.ajax({
data: 'serverid=' + YAMS.admin.selectedServer + '&action=save-server-settings&' + $('#settings-form').serialize()
@richardbenson
richardbenson / gist:1446631
Created December 8, 2011 10:13
Why I love jQuery
function createDialog(strName, intWidth, strHeader, strTemplate, funcOnLoad, objButtons) {
var dialog = $('<div id="' + strName + '"><div style="text-align: center"><img src="/assets/images/ajax-loader.gif" /></div></div>').dialog({
modal: true,
open: function () {
if (typeof (strTemplate) != "undefined") $(this).load(strTemplate, funcOnLoad);
},
close: function (event, ui) {
$(this).remove();
},
width: intWidth,
@richardbenson
richardbenson / inexplicable.js
Created May 31, 2011 14:40
A supplier put this on their interface. There are no words to describe how stupid this is, especially on a page that links a number of other pages INCLUDING EXTERNAL SITES.
function preventBack(){
try{
history.forward();
setTimeout('preventBack()', 500);
}catch(e){}
}
preventBack();
SELECT UnitName, (
SUM( HostNationKIA ) + SUM( EnemyKIA ) + Sum( CivilianKIA )
) AS Kills
FROM war_diary
GROUP BY UnitName
ORDER BY Kills DESC