Skip to content

Instantly share code, notes, and snippets.

@as-com
as-com / Error1
Created December 30, 2013 18:30
Vanilla Forums Htmlawed preg_replace error, with error given by attempted fix
Fatal Error in PHP.preg_replace();
preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
The error occurred on or near: /home/[...]/forums-[...]-com/plugins/HtmLawed/htmLawed/htmLawed.php
378:
379: function hl_spec($t){
380: // final $spec
381: $s = array();
382: $t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace('/"(?>(`.|[^"])*)"/sme', 'substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", \'`"\'), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\""), "$0"), 1, -1)', trim($t)));
383: for($i = count(($t = explode(';', $t))); --$i>=0;){
@as-com
as-com / gist:8196334
Created December 31, 2013 12:51
Cloudflare only serving part of the file when the cache is empty
(function(e,h,l,c){e.fn.sonar=function(o,n){if(typeof o==="boolean"){n=o;o=c}return e.sonar(this[0],o,n)};var f=l.body,a="scrollin",m="scrollout",b=function(r,n,t){if(r){f||(f=l.body);var s=r,u=0,v=f.offsetHeight,o=h.innerHeight||l.documentElement.clientHeight||f.clientHeight||0,q=l.documentElement.scrollTop||h.pageYOffset||f.scrollTop||0,p=r.offsetHeight||0;if(!r.sonarElemTop||r.sonarBodyHeight!==v){if(s.offsetParent){do{u+=s.offsetTop}while(s=s.offsetParent)}r.sonarElemTop=u;r.sonarBodyHeight=v}n=n===c?0:n;return(!(r.sonarElemTop+(t?0:p)<q-n)&&!(r.sonarElemTop+(t?p:0)>q+o+n))}},d={},j=0,i=function(){setTimeout(function(){var s,o,t,q,p,r,n;for(t in d){o=d[t];for(r=0,n=o.length;r<n;r++){q=o[r];s=q.elem;p=b(s,q.px,q.full);if(t===m?!p:p){if(!q.tr){if(s[t]){e(s).trigger(t);q.tr=1}else{o.splice(r,1);r--;n--}}}else{q.tr=0}}}},25)},k=function(n,o){n[o]=0},g=function(r,p){var t=p.px,q=p.full,s=p.evt,o=b(r,t,q),n=0;r[s]=1;if(s===m?!o:o){setTimeout(function(){e(r).trigger(s===m?m:a)},0);n=1}d[s].push({elem:r,px:t,full
@as-com
as-com / config.php
Created January 5, 2014 17:07
Config.php from Vanilla Forums install
<?php if (!defined('APPLICATION')) exit();
// Conversations
$Configuration['Conversations']['Version'] = '2.1b2';
// Database
$Configuration['Database']['Name'] = 'vanilla';
$Configuration['Database']['Host'] = 'localhost';
$Configuration['Database']['User'] = 'vanilla';
$Configuration['Database']['Password'] = 'XXXXXXXXX';
@as-com
as-com / GDN_Badge.sql
Created January 5, 2014 19:22
SQL dump of the badges table, from Vanilla Forums w/ the Yet Another Gamification Application.
-- phpMyAdmin SQL Dump
-- version 4.0.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 05, 2014 at 02:21 PM
-- Server version: 5.5.33a-MariaDB-1~squeeze-log
-- PHP Version: 5.4.9-4ubuntu2.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@as-com
as-com / grep.log
Created March 5, 2014 19:50
Wordfence failing to recognize a WordPress brute force attack from an IPv6 address
2a03:7380:2c0:2:a432:704f:c225:4a62 - - [04/Mar/2014:21:01:33 -0500] "POST /wp-login.php/ HTTP/1.1" 200 4981 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2"
2a03:7380:2c0:2:a432:704f:c225:4a62 - - [04/Mar/2014:21:01:36 -0500] "POST /wp-login.php/ HTTP/1.1" 200 4982 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2"
2a03:7380:2c0:2:a432:704f:c225:4a62 - - [04/Mar/2014:21:01:38 -0500] "POST /wp-login.php/ HTTP/1.1" 200 4982 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2"
2a03:7380:2c0:2:a432:704f:c225:4a62 - - [04/Mar/2014:21:01:39 -0500] "POST /wp-login.php/ HTTP/1.1" 200 4981 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2"
2a03:7380:2c0:2:a432:704f:c225:4a62 - - [04/Mar/2014:21:01:41 -0500] "POST /wp-login.php/ HTTP/1.1" 200 4982 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2"
2a03:7380
@as-com
as-com / jsdelivr-repo-files.txt
Created May 31, 2014 18:42
List of files in jsDelivr repo, sorted by size
This file has been truncated, but you can view the full file.
2.9M ./openlayers/2.13.1/OpenLayers.debug.js
2.3M ./phaser/2.0.4/phaser.js
2.2M ./phaser/2.0.3/phaser.js
2.2M ./darfonts/0.1/fdk-fpa-irn-isp/irannastaliq-webfont.svg
2.1M ./phaser/2.0.0/phaser.js
2.0M ./uniformjs/2.0.0/themes/jeans/images/sprite-retina-jeans.png
2.0M ./sass.js/0.3.0/worker.min.js
2.0M ./sass.js/0.3.0/sass.min.js
1.8M ./typescript/1.0.0/typescript.min.js
1.6M ./cufon-fonts-library/0.1/FFF_Tusj-webfont.font.js
<?php
/*
Plugin Name: Memcached Redux
Description: The real Memcached (not Memcache) backend for the WP Object Cache.
Version: 0.1.3
Plugin URI: http://wordpress.org/extend/plugins/memcached/
Author: Scott Taylor - uses code from Ryan Boren, Denis de Bernardy, Matt Martz, Mike Schroder
Install this file to wp-content/object-cache.php
*/
#!/usr/bin/env python
"""
This script allows one to submit resources (URLs and files) for analysis.
The submission consists of 2 steps: URL submission and result retrieval.
1. To request the processing of a resource, use the -s option with the URL
or filename to be checked:
$ python submit_to_wepawet.py -s 'http://www.cs.ucsb.edu/'
<?xml version="1.0" encoding="utf-8" ?>
@as-com
as-com / calcPier16.js
Last active August 29, 2015 14:03
Possible distances for pier 16 in jl2579's Journey to the Minecraft World Edge Livestream
// Script to calculate distances for pier 16
// Best run with `nodejs calcPier16.js > pier16.txt`
// Also possible to paste into JS console of browser
function sumDigits(number) {
var str = number.toString();
var sum = 0;
for (var i = 0; i < str.length; i++) {
sum += parseInt(str.charAt(i), 10);
@as-com
as-com / pier18.js
Created July 14, 2014 13:18
Possible distances for pier 18 in jl2579's Journey to the Minecraft World Edge Livestream
function sumDigits(number) {
var str = number.toString();
var sum = 0;
for (var i = 0; i < str.length; i++) {
sum += parseInt(str.charAt(i), 10);
}
return sum;
}