This file contains hidden or 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
/* SHA-256 implementation in JavaScript | (c) Chris Veness 2002-2010 | www.movable-type.co.uk */ | |
/* - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html */ | |
/* http://csrc.nist.gov/groups/ST/toolkit/examples.html */ | |
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
var Sha256 = {}; // Sha256 namespace | |
/** | |
* Generates SHA-256 hash of string | |
* |
This file contains hidden or 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
Number.prototype.toBinary=function(width, zero, one){ | |
var b=this.toString(2); | |
var zeroString = ''; | |
if (width) if ((width-b.length)>0) zeroString = Math.pow(10,width-b.length).toString().substr(1); | |
var output = zeroString + b; | |
if ((zero) && (one)) { | |
if (typeof(zero)=='number') zero=String.fromCharCode(zero); | |
if (typeof(one)=='number') one=String.fromCharCode(one); | |
output = output.replace(/0/g,zero); | |
output = output.replace(/1/g,one); |
This file contains hidden or 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
findInverse=function(a,b){ | |
n=b;x=0;lastx=1; | |
while (b!= 0){ | |
q=~~(a/b); | |
temp=a; | |
a=b; | |
b=temp % b; | |
temp=x; | |
x= lastx - q*temp; | |
lastx=temp; |
This file contains hidden or 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
# Finally, thanking Larry Hall on cygwin newsgroup | |
# I have my edit command to use my favorite text editor on Cygwin :-D | |
# These lines must be inserted in .bashrc file in your home | |
function edit() { | |
cygstart /cygdrive/c/Programmi/Crimson\ Editor/cedt.exe "$(cygpath -w "$*")"; | |
} | |
# Simpler, but useful, the open function | |
function open(){ cygstart "$*";} |
This file contains hidden or 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
/* | |
With the following code you can create a static url that automatically redirect to the apod (Astronomy Image of the day | |
* You can use it like wallpaper in your Firefox's about:home page. Look at next file | |
Download Simple HTML parser from here: | |
http://simplehtmldom.sourceforge.net/ | |
*/ | |
<?php | |
function randomImage(){ | |
$best_images = Array( |
This file contains hidden or 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
@echo off | |
REM Set you API KEY http://imgur.com/register/api_anon | |
set apikey=your_apikey_here | |
REM Usage: | |
REM img file_path [title] [caption] | |
REM img url [title] [caption] | |
REM title and caption are optional, quote them if they contains spaces or strange characters | |
REM Set the path where are located curl.exe and sed.exe |
This file contains hidden or 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
const STATUSNET_STATUS_MAX_LEN = 140; | |
const STATUSNET_DOMAIN = "mozilla.status.net"; | |
const STATUSNET_NAME = "mozilla status"; /* Change the name of command manually */ | |
var noun_type_statusnet_user = { | |
label: "user", | |
rankLast: true, | |
noExternalCalls: true, | |
cacheTime: 0, | |
suggest: function nt_twuser_suggest(text, html, cb, selected) { |
This file contains hidden or 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
/* This command open the profile folder */ | |
function openLocalFolder(dir){ | |
nsLocalFile = Components.Constructor("@mozilla.org/file/local;1","nsILocalFile", "initWithPath"); | |
new nsLocalFile(dir).reveal(); | |
} | |
CmdUtils.CreateCommand({ | |
names: ["open-profile"], | |
description: "Open the profile directory in your file explorer..", | |
help: "Type open-profile to open the profile folder.", | |
author: { |
This file contains hidden or 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
/* This command open the profile folder */ | |
function openLocalFolder(dir){ | |
nsLocalFile = Components.Constructor("@mozilla.org/file/local;1","nsILocalFile", "initWithPath"); | |
new nsLocalFile(dir).reveal(); | |
} | |
CmdUtils.CreateCommand({ | |
names: ["open-profile"], | |
description: "Open the profile directory in your file explorer..", | |
help: "Type open-profile to open the profile folder.", | |
author: { |
This file contains hidden or 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
/* This is a template command. */ | |
CmdUtils.CreateCommand({ | |
names: ["example"], | |
description: "A short description of your command.", | |
help: "How to use your command.", | |
author: { | |
name: "Your Name", | |
email: "[email protected]", | |
homepage: "http://labs.mozilla.com/", | |
}, |