Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

David Norman deekayen

🏠
Working from home
View GitHub Profile
@deekayen
deekayen / homebrew-php54-phpini
Created Mar 4, 2014
A diff between my /etc/php.ini and the default php.ini file installed by Jose's Homebrew formula.
View homebrew-php54-phpini
--- /etc/php.ini 2014-02-27 16:15:52.000000000 -0500
+++ /usr/local/etc/php/5.4/php.ini 2014-02-05 03:22:22.000000000 -0500
@@ -1,7 +1,4 @@
[PHP]
-zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
-xdebug.remote_enable=On
-detect_unicode = off
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
@deekayen
deekayen / tokutest.php
Last active Aug 29, 2015
A shell script, written in PHP, to test the difference in time for importing and exporting dumps from MariaDB using either InnoDB or TokuDB engines. Spoiler: Dumps are the same speed, TokuDB imports are 2x slower than InnoDB. Note: this is a destructive script and will delete anything in the database you configure to be used.
View tokutest.php
#!/usr/bin/php
<?php
$db = array();
$db['host'] = 'localhost';
$db['user'] = 'root';
$db['password'] = '';
$db['database'] = 'toku';
@deekayen
deekayen / barracuda.php
Created May 14, 2014
A timer script I wrote to find out how long it would take to do a command-line import of a SQL file. Used to test the difference in import times between the Antelope and Barracuda XtraDB storage formats. Barracuda turned out a 3% speed gain.
View barracuda.php
#!/usr/bin/php
<?php
$db = array();
$db['host'] = 'localhost';
$db['user'] = 'root';
$db['password'] = '';
$db['database'] = 'barracuda';
@deekayen
deekayen / normananalyzer.js
Created Jun 18, 2014
Norman keyboard layout analyzer by Nahuel Caponi from http://jsfiddle.net/Deban/qJLLm/
View normananalyzer.js
var keyboards = [];
var text = "";
//To create a keyboard:
//call the CreateKeyboard function, then pass the name, add a comma,
//lastly spam your first 10 keys for each row
//don't use the numbers row and don't use more than 10 keys per row
CreateKeyboard("qwerty", "qwertyuiopasdfghjkl;zxcvbnm,./");
CreateKeyboard("colemak", "qwfpgjluy;arstdhneiozxcvbkm,./");
CreateKeyboard("workman", "qdrwbjfup;ashtgyneoizxmcvkl,./");
@deekayen
deekayen / scan_drupal_nodes.php
Last active Aug 29, 2015
Node enumeration script finds the availability of content within a Drupal site for audit purposes. May help uncover pages mistakenly available to anonymous users.
View scan_drupal_nodes.php
<?php
$url_prefix = 'https://deekayen.net/node/';
$low = 1400;
$high = 1450;
$output_file = '/Users/davidnorman/Sites/scan/scan.csv';
/******************************************/
$fp = fopen($output_file, 'w');
@deekayen
deekayen / spelling.php
Created Jul 3, 2014
This file used to work with PHP and the Pspell extension but later around PHP 4.3.1 and the release of Aspell 0.50.2, it stopped working, complaining about not finding the right dictionary.
View spelling.php
<?php
// unset it just in case someone tried to set it from the URL with register_globals on
unset($suggestion_found);
session_start();
define("NL", "\n");
function check_textarea($message) {
return htmlspecialchars(stripslashes($message));
View trim_drupal_node_revisions.sql
DELETE FROM node_revisions WHERE vid IN (
SELECT subquery.vid FROM (
SELECT @row_num := IF(@prev_value=nr.nid,@row_num+1,1) AS RowNumber
,nr.nid
,nr.vid
,nr.timestamp
,@prev_value := nr.nid
FROM node_revisions nr,
(SELECT @row_num := 1) x,
(SELECT @prev_value := '') y
@deekayen
deekayen / trim_drupal_node_revisions.sql
Last active Aug 29, 2015 — forked from anonymous/trim_drupal_node_revisions.sql
Delete revisions from the Drupal 7 node_revisions table such that only the newest 3 revisions remain for each node. It joins on the node table to make sure that the current, active vid assigned in the node table doesn't get deleted.
View trim_drupal_node_revisions.sql
DELETE FROM node_revisions WHERE vid IN (
SELECT subquery.vid FROM (
SELECT @row_num := IF(@prev_value=nr.nid,@row_num+1,1) AS RowNumber
,nr.nid
,nr.vid
,nr.timestamp
,@prev_value := nr.nid
FROM node_revisions nr,
(SELECT @row_num := 1) x,
(SELECT @prev_value := '') y
@deekayen
deekayen / wmic_count.php
Created Nov 27, 2014
Count the number of running svchost.exe processes on a Windows server using PHP
View wmic_count.php
<?php
$wmic = `wmic process get description`;
$total_svchost_running = substr_count($wmic, 'svchost.exe');
echo 'Total svchost.exe processes: ' . $total_svchost_running;
@deekayen
deekayen / find_kazy.sh
Created Nov 29, 2014
Ghetto scanner to locate the Gen:Variant.Kazy.378723 virus/trojan using find and grep
View find_kazy.sh
#!/bin/sh
# A hacky way to find a variant of the Kazy trojan virus.
# Maybe helpful if your Windows users had a Samba mount that got infected.
# See also:
# https://www.virustotal.com/en/file/25eaf33c12a669cd9ab6fc4f55fecc085704a4ee5f015ffb8bfdb1495a009f5a/analysis/1417196359/
find / -type f -iname '*.exe' -exec grep -R "lKTGM$S" {} \;
find / -type f -iname '*.exe' -exec grep -R "yUXWncK" {} \;