Skip to content

Instantly share code, notes, and snippets.

John Maguire JohnMaguire

Block or report user

Report or block JohnMaguire

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JohnMaguire
JohnMaguire / php_random.php
Created Jun 6, 2011
Graphical Representation of PHP rand() vs mt_rand()
View php_random.php
<?php
function getRand($min, $max, $type='mt_rand')
{
switch($type)
{
case 'rand':
return rand(1, 500);
break;
default:
@JohnMaguire
JohnMaguire / getBrowser.php
Created Jun 7, 2011
A PHP function to return a user-friendly browser string
View getBrowser.php
<?php
/**
* Takes a string (presumably a user agent) and determines the browser the
* best it can from the string.
*
* @version 1.0
*/
function getBrowser($useragent)
{
View gist:1134678
???[$ minecraft
16 achievements
151 recipes
Setting user: lulzplzkthx, 2839971854394647860
failed to create drawable
org.lwjgl.LWJGLException: X Error - disp: 0x9189118 serial: 95 error: BadGC (invalid GC parameter) request_code: 60 minor_code: 0
at org.lwjgl.opengl.LinuxDisplay.globalErrorHandler(LinuxDisplay.java:268)
at org.lwjgl.opengl.LinuxKeyboard.nSetDetectableKeyRepeat(Native Method)
at org.lwjgl.opengl.LinuxKeyboard.setDetectableKeyRepeat(LinuxKeyboard.java:152)
at org.lwjgl.opengl.LinuxKeyboard.destroy(LinuxKeyboard.java:163)
View gist:1134708
org.lwjgl.LWJGLException: X Error - disp: 0x97cc220 serial: 95 error: BadGC (invalid GC parameter) request_code: 60 minor_code: 0
at org.lwjgl.opengl.LinuxDisplay.globalErrorHandler(LinuxDisplay.java:277)
at org.lwjgl.opengl.LinuxKeyboard.nSetDetectableKeyRepeat(Native Method)
at org.lwjgl.opengl.LinuxKeyboard.setDetectableKeyRepeat(LinuxKeyboard.java:152)
at org.lwjgl.opengl.LinuxKeyboard.destroy(LinuxKeyboard.java:163)
at org.lwjgl.opengl.LinuxDisplay.destroyKeyboard(LinuxDisplay.java:1061)
at org.lwjgl.input.Keyboard.destroy(Keyboard.java:349)
at org.lwjgl.opengl.Display.destroyWindow(Display.java:357)
at org.lwjgl.opengl.Display.access$300(Display.java:67)
at org.lwjgl.opengl.Display$3.destroy(Display.java:146)
View gist:1136019
???[$ sudo mke2fs -b 2048 /dev/sr0
mke2fs 1.41.14 (22-Dec-2010)
/dev/sr0 is entire device, not just one partition!
Proceed anyway? (y,n) y
mke2fs: inode_size (128) * inodes_count (0) too big for a
filesystem with 0 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
View gist:1367482
>>> for key, value in audio.tags.iteritems():
... print key
...
APIC:
TLEN
TDRC
TIT2
APIC:Front cover
TRCK
TPE2
View screen_awayi.pl
use Irssi;
use strict;
use FileHandle;
use vars qw($VERSION %IRSSI);
$VERSION = "0.9.7.1";
%IRSSI = (
authors => 'Andreas \'ads\' Scherbaum <ads@wars-nicht.de>, John \'lulzplzkthx\' Maguire',
name => 'screen_awayi',
View screen_awayi.pl
use Irssi;
use strict;
use FileHandle;
use vars qw($VERSION %IRSSI);
$VERSION = "0.9.7.1";
%IRSSI = (
authors => 'Andreas \'ads\' Scherbaum <ads@wars-nicht.de>, John \'lulzplzkthx\' Maguire',
name => 'screen_awayi',
View deluged.log
[ERROR ] 14:15:53 rpcserver:303 Exception calling RPC request: '6e76a2a5193ae6c680704c269048062f47b290f9'
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.3-py2.6-linux-x86_64.egg/deluge/core/rpcserver.py", line 298, in dispatch
ret = self.factory.methods[method](*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.3-py2.6-linux-x86_64.egg/deluge/core/core.py", line 431, in get_torrents_status
status_dict[torrent_id] = self.get_torrent_status(torrent_id, keys, diff)
File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.3-py2.6-linux-x86_64.egg/deluge/core/core.py", line 413, in get_torrent_status
status = self.torrentmanager[torrent_id].get_status(keys, diff)
File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.3-py2.6-linux-x86_64.egg/deluge/core/torrentmanager.py", line 277, in __getitem__
return self.torrents[torrent_id]
View init.js
plugin.loadLang();
plugin.onLangLoaded = function()
{
if(this.enabled)
{
if(plugin.canChangeMenu())
{
theDialogManager.make('dlg_crossseed', theUILang.crossseed,
"<div class='cont fxcaret'>" +
You can’t perform that action at this time.