Skip to content

Instantly share code, notes, and snippets.

Nolan Caudill mncaudill

Block or report user

Report or block mncaudill

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
View gist:aa27e3a593010d2b5959
### Keybase proof
I hereby claim:
* I am mncaudill on github.
* I am nolancaudill (https://keybase.io/nolancaudill) on keybase.
* I have a public key whose fingerprint is 9D0C CFF7 8DCA 368E 45A7 518E 9049 BD66 4E14 B04C
To claim this, I am signing this object:
@mncaudill
mncaudill / gist:1380033
Created Nov 20, 2011
ArchLinux + Gnome -- don't suspend laptop when closed
View gist:1380033
ACPI can run, but gnome also has a hook into what happens when ACPI events happen. I spent waaay too much time fighting with this...
gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action nothing
gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action nothing
Or run dconf-editor and navigate through the trees.
@mncaudill
mncaudill / similar.php
Created Oct 31, 2011
PHP version of simple image similarity algorithm
View similar.php
<?php
# Algorithm found here: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html
$filename = 'image.jpg';
list($width, $height) = getimagesize($filename);
$img = imagecreatefromjpeg($filename);
$new_img = imagecreatetruecolor(8, 8);
@mncaudill
mncaudill / jslint.js
Created Jan 8, 2011
This is the Rhino-ready version of jslint. This file has almost disappeared from the Internet so I'm putting it here for posterity.
View jslint.js
// (C)2002 Douglas Crockford
// www.JSLint.com
// Rhino Edition
"use strict";var JSLINT=(function(){var adsafe_id,adsafe_may,adsafe_went,anonname,approved,atrule={media:true,'font-face':true,page:true},bang={'<':true,'<=':true,'==':true,'===':true,'!==':true,'!=':true,'>':true,'>=':true,'+':true,'-':true,'*':true,'/':true,'%':true},banned={'arguments':true,callee:true,caller:true,constructor:true,'eval':true,prototype:true,unwatch:true,valueOf:true,watch:true},boolOptions={adsafe:true,bitwise:true,browser:true,cap:true,css:true,debug:true,eqeqeq:true,evil:true,forin:true,fragment:true,immed:true,laxbreak:true,newcap:true,nomen:true,on:true,onevar:true,passfail:true,plusplus:true,regexp:true,rhino:true,undef:true,safe:true,sidebar:true,strict:true,sub:true,white:true,widget:true},browser={addEventListener:false,alert:false,blur:false,clearInterval:false,clearTimeout:false,close:false,closed:false,confirm:false,console:false,Debug:false,defaultStatus:false,document:false,event:false,focus:false,frames:false,get
@mncaudill
mncaudill / build.sh
Created Dec 21, 2010
BigQuine: PHP->C->Python->JS->original PHP program
View build.sh
#!/bin/bash
php php-c-python-js-php-quine.php > quine.c
gcc -Wall -o quinec quine.c
./quinec > quine.py
python quine.py > quine.js
node quine.js > quine.php
diff php-c-python-js-php-quine.php quine.php
@mncaudill
mncaudill / php-js-php-quine.php
Created Dec 21, 2010
Another quine. This one is a PHP program that prints a JavaScript program (I ran mine with node) that when the JS program is ran, it prints out the original PHP program.
View php-js-php-quine.php
<?php
$php="112,114,105,110,116,32,34,112,104,112,61,91,36,112,104,112,93,59,115,116,114,105,110,103,61,39,39,59,99,111,110,115,111,108,101,46,108,111,103,40,39,60,63,112,104,112,39,41,59,99,111,110,115,111,108,101,46,108,111,103,40,39,39,41,59,102,111,114,40,105,61,48,59,105,60,112,104,112,46,108,101,110,103,116,104,59,105,43,43,41,123,115,116,114,105,110,103,43,61,112,104,112,91,105,93,43,39,44,39,59,125,99,111,110,115,111,108,101,46,108,111,103,40,39,92,36,112,104,112,61,92,34,39,43,115,116,114,105,110,103,43,39,92,34,59,39,41,59,99,111,110,115,111,108,101,46,108,111,103,40,39,39,41,59,115,116,114,105,110,103,61,39,39,59,102,111,114,40,105,61,48,59,105,60,112,104,112,46,108,101,110,103,116,104,59,105,43,43,41,123,115,116,114,105,110,103,43,61,83,116,114,105,110,103,46,102,114,111,109,67,104,97,114,67,111,100,101,40,112,104,112,91,105,93,41,59,125,99,111,110,115,111,108,101,46,108,111,103,40,115,116,114,105,110,103,41,59,34,59,";
print "php=[$php];string='';console.log('<?php');console.log('');for(i=0;i<p
@mncaudill
mncaudill / php-quine.php
Created Dec 21, 2010
This is a PHP quine. When run, this program will print out an exact version of itself.
View php-quine.php
<?php
$data = array(
36,110,108,32,61,32,99,104,114,40,49,48,41,59,10,112,114,105,110,116,32,34,60,63,112,104,112,36,110,108,36,110,108,92,36,100,97,116,97,32,61,32,97,114,114,97,121,40,36,110,108,34,59,10,10,102,111,114,101,97,99,104,40,36,100,97,116,97,32,97,115,32,36,100,41,32,123,10,32,32,32,112,114,105,110,116,32,34,36,100,44,34,59,32,32,10,125,10,10,112,114,105,110,116,32,34,36,110,108,41,59,36,110,108,36,110,108,34,59,10,10,102,111,114,101,97,99,104,40,36,100,97,116,97,32,97,115,32,36,100,41,32,123,10,32,32,32,32,112,114,105,110,116,32,115,112,114,105,110,116,102,40,34,37,99,34,44,32,36,100,41,59,10,125,10,
);
$nl = chr(10);
print "<?php$nl$nl\$data = array($nl";
foreach($data as $d) {
You can’t perform that action at this time.