Skip to content

Instantly share code, notes, and snippets.

@jpswade
jpswade / mysql2sqlite.sh
Created July 27, 2012 09:34 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@jpswade
jpswade / hp-drivers
Created December 4, 2012 11:52
@HP Please fix your website
Please fix your website.
On this page
* http://welcome.hp.com/country/uk/en/cs/support-drivers.html
Click 'DETECT YOUR PRODUCT'.
* http://h20270.www2.hp.com/ediags/gmn2/index.aspx?detectProducts=Start+Detection+%BB&lc=en&cc=uk
@jpswade
jpswade / gist:4571750
Created January 19, 2013 10:06
How do you remove numbers from a string in PHP?
<?php
$string = 'abc123';
$string = str_replace(range(0,9), '', $string);
echo $string;
/* http://codepad.org/AYECJrbZ */
?>
@jpswade
jpswade / gist:5014891
Created February 22, 2013 16:57
Shuffle with associative keys
<?php
function ashuffle (&$array) {
$shuffle = $array;
shuffle($shuffle);
return $array = array_combine(array_keys($array), $shuffle);
}
?>
<?php
function ashuffle (&$array) {
$shuffle = $array;
shuffle($shuffle);
return $array = array_combine(array_keys($array), $shuffle);
}
?>
@jpswade
jpswade / gist:fb6131a3f0da41f79cdd
Created July 29, 2014 11:04
VERR_REM_VIRTUAL_CPU_ERROR
VirtualBox VM 4.3.14 r95030 win.x86 (Jul 15 2014 18:13:31) release log
00:00:00.841817 Log opened 2014-07-29T10:45:04.687000000Z
00:00:00.841860 Build Type: release
00:00:00.841871 OS Product: Windows 7
00:00:00.841874 OS Release: 6.1.7601
00:00:00.841876 OS Service Pack: 1
00:00:01.008464 DMI Product Name: Dimension E521
00:00:01.015123 DMI Product Version:
00:00:01.015136 Host RAM: 3326MB total, 940MB available
00:00:01.015139 Executable: C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe
@jpswade
jpswade / install_cpanel.sh
Last active October 5, 2023 15:54
Install cPanel for CentOS
#!/bin/bash
# setup_cpanel - Setup new cPanel Server.
# @see https://gist.github.com/jpswade/4e2826d5c88cee4eac72
# @see https://docs.cpanel.net/installation-guide/cpanel-dnsonly-installation/
set -e
### Settings
CPANEL_SCRIPT_URL=http://httpupdate.cpanel.net/
CPANEL_SCRIPT=latest
vagrantfile:
target: local
vm:
box: puphpet/centos65-x64
box_url: puphpet/centos65-x64
hostname: ''
memory: '512'
cpus: '1'
chosen_provider: virtualbox
network:
@jpswade
jpswade / IPCAM.pm
Created July 4, 2015 21:27
/usr/share/perl5/vendor_perl/ZoneMinder/Control/IPCAM.pm from http://www.zoneminder.com/wiki/index.php/Foscam_Clones
# ==========================================================================
#
# ZoneMinder IPCAM Control Protocol Module, $Date: 2009-11-25 09:20:00 +0000 (Wed, 04 Nov 2009) $, $Revision: 0001 $
# Copyright (C) 2001-2008 Philip Coombes
# Modified for use with Foscam FI8918W IP Camera by Dave Harris
# Modified Feb 2011 by Howard Durdle (http://durdl.es/x) to:
# fix horizontal panning, add presets and IR on/off
# use Control Device field to pass username and password
# Modified June 5th, 2012 by Chris Bagwell to:
# Rename to IPCAM since its common protocol with wide range of cameras.
sleep 1
t app key mode
sleep 1
t app key record
sleep 1
d:\autoexec2.ash