Skip to content

Instantly share code, notes, and snippets.

View daxxog's full-sized avatar

David Volm daxxog

View GitHub Profile
@daxxog
daxxog / gist:3903014
Created October 17, 2012 00:32 — forked from Synchro/gist:1139429
PHP Base-62 encoder/decoder
<?php
/**
* This is an example of a practical encoder and decoder for base-62 data in PHP
* It differs from the majority of examples in that it's fast enough for moderate data sizes, unlike multiprecision converters
* To be practical, base-62 encoding needs to use internal chunking and padding because base-62 does not fit exactly into any integral number of bits
* This means the output is not quite compatible with multiprecision conversions,
* but the encoded data retains all the desirable properties of base-62, so (unlike any base-64 encoding) it's URL, DNS, email address and pathname safe
* @author Marcus Bointon <marcus@synchromedia.co.uk>
* @copyright 2011 Marcus Bointon
* @license http://www.opensource.org/licenses/mit-license.html MIT License
@daxxog
daxxog / fgitignore.sh
Created October 23, 2012 14:44
fix .gitignore
#from: http://stackoverflow.com/a/1139797
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@daxxog
daxxog / codeheader.js
Last active October 12, 2015 07:48
my code header
/* name
* description
* (c) 2013 David (daXXog) Volm ><> + + + <><
* Released under Apache License, Version 2.0:
* http://www.apache.org/licenses/LICENSE-2.0.html
*/
@daxxog
daxxog / fs.exists.js
Created November 7, 2012 16:22
fs.exists support for older node versions
//fs.exists support for older node versions
if(typeof fs.exists != 'function') {
fs.exists = path.exists;
}
if(typeof fs.existsSync != 'function') {
fs.existsSync = path.existsSync;
}
I know this may be old news, and I know that busy box has most of the things that shadow utils already does BUT there are a few very useful things like usermod that it doesn't. After searching around I figured I would add some useful info here. I spent about an hour fumbling around with it so I hope this helps anyone else out there that wants it. First of all you have to have the tool chain installed. Normally it's hard to find this code for shadow-utils but it is downloadable here: http://ftp.pld-linux.org/software/shadow On a quick side note - There are many other utilities and their code downloadable here: http://www.happy-monkey.net/architect/minimalist/cmd-util.html I found that there was a small error in the make'ing of this code, so I fixed that (more on that in a moment.) and built it successfully on the latest cooking. wget ftp://ftp.pld-linux.org/software/shadow/shadow-4.0.3.tar.gz tar zxvf shadow-4.0.3.tar.gz cd shadow-4.0.3 vi libmisc/xmalloc.c # comment out the following line with C style com
@daxxog
daxxog / rapidshare-daxxog.md
Created December 13, 2012 16:33
My rapidshare files with descriptions.
@daxxog
daxxog / isArray.js
Created December 27, 2012 18:35
isArray function for javascript
var isArray = function(obj) {
return (typeof obj == 'object') && (obj instanceof Array);
};
@daxxog
daxxog / hopt.js
Created December 29, 2012 18:52
//redis hash optimizer
var hopt = function(key, what, level) { //redis hash optimizer
var _what = what.toString();
return [key + _what.substr(0, _what.length - level), _what.substr(_what.length - level, _what.length)];
};
@daxxog
daxxog / git-remove-old-files.sh
Created January 17, 2013 17:50
Remove old files from git repo
git add -u
git commit -m "Cleaned up old files."
#!/bin/bash
#curl -L https://gist.github.com/raw/4597895/noip-install.sh | sh
#get gcc toolchain
sudo apt-get update
sudo apt-get install make gcc -y
#make a dev directory and switch to it
cd ~
mkdir dev