This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ | |
function bytesToSize(bytes) { | |
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | |
if (bytes == 0) return 'n/a'; | |
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); | |
if (i == 0) return bytes + ' ' + sizes[i]; | |
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download and install setuptools | |
curl -O https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | |
python3 ez_setup.py | |
# download and install pip | |
curl -O https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | |
python3 get-pip.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pynarcissus import jsparser | |
from collections import defaultdict | |
class Visitor(object): | |
CHILD_ATTRS = ['thenPart', 'elsePart', 'expression', 'body', 'initializer'] | |
def __init__(self, filepath): | |
self.filepath = filepath | |
#List of functions by line # and set of names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function xhr(options) { | |
var deferred = Q.defer(), | |
req = new XMLHttpRequest(); | |
req.open(options.method || 'GET', options.url, true); | |
// Set request headers if provided. | |
Object.keys(options.headers || {}).forEach(function (key) { | |
req.setRequestHeader(key, options.headers[key]); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://fredrik.appelberg.me/2010/05/07/aop-js.html | |
var Aop = { | |
// Apply around advice to all matching functions in the given namespaces | |
around: function(pointcut, advice, namespaces) { | |
// if no namespaces are supplied, use a trick to determine the global ns | |
if (namespaces == undefined || namespaces.length == 0) | |
namespaces = [ (function(){return this;}).call() ]; | |
// loop over all namespaces | |
for(var i in namespaces) { | |
var ns = namespaces[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts an image to | |
* a base64 string. | |
* | |
* If you want to use the | |
* outputFormat or quality param | |
* I strongly recommend you read the docs | |
* @ mozilla for `canvas.toDataURL()` | |
* | |
* @param {String} url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Build instructions: | |
// $ gcc keychaindump.c -o keychaindump -lcrypto | |
// Usage: | |
// $ sudo ./keychaindump [path to keychain file, leave blank for default] | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <mach/mach.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These two files should help you to import passwords from mac OS X keychains to 1password. | |
Assumptions: | |
1) You have some experience with scripting/are a power-user. These scripts worked for me | |
but they haven't been extensively tested and if they don't work, you're on your own! | |
Please read this whole document before starting this process. If any of it seems | |
incomprehensible/frightening/over your head please do not use these scripts. You will | |
probably do something Very Bad and I wouldn't want that. | |
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous | |
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These two files should help you to import passwords from mac OS X keychains to 1password. | |
Assumptions: | |
1) You have some experience with scripting/are a power-user. These scripts worked for me | |
but they haven't been extensively tested and if they don't work, you're on your own! | |
Please read this whole document before starting this process. If any of it seems | |
incomprehensible/frightening/over your head please do not use these scripts. You will | |
probably do something Very Bad and I wouldn't want that. | |
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous | |
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
*@author William_Wilson | |
*@version 2.0 | |
*Created May 10, 2007 | |
*/ | |
/* | |
*Import List | |
*/ |