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
const {utils: Cu} = Components; | |
const { atob, btoa } = Cu.import("resource://gre/modules/Services.jsm"); | |
//can now use atob and btoa freely | |
//if it is utf-8 then do the following: | |
function atobUTF8(data) { | |
return decodeURIComponent(escape(atob(data))) | |
} |
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
/*run this first*/ | |
var win = Services.wm.getMostRecentWindow('navigator:browser'); | |
var panel = win.document.createElement('panel'); | |
var screen = Services.appShell.hiddenDOMWindow.screen; | |
var props = { | |
noautohide: true, | |
noautofocus: false, | |
level: 'top', | |
style: 'padding:15px; margin:0; width:' + screen.availWidth + 'px; height:' + screen.availHeight + 'px; background-color:transparent; -moz-pointer-events:none; border:0; -moz-appearance:none !important;' | |
} |
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
/*example functions must be at bottom, this big chunk of code must run first*/ | |
//this big chunk of block suports all SHA-1 to SHA-512 | |
/* | |
A JavaScript implementation of the SHA family of hashes, as | |
defined in FIPS PUB 180-2 as well as the corresponding HMAC implementation | |
as defined in FIPS PUB 198a | |
Copyright Brian Turek 2008-2013 |
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
initSHA1(this); //onload must run this once, put at very top of your script, because calcHMAC will not work unless this initSHA1 has run | |
var SignatureBaseString = 'POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.json&include_entities%3Dtrue%26oauth_consumer_key%3Dxvz1evFS4wEEPTGEFPHBog%26oauth_nonce%3DkYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1318622958%26oauth_token%3D370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb%26oauth_version%3D1.0%26status%3DHello%2520Ladies%2520%252B%2520Gentlemen%252C%2520a%2520signed%2520OAuth%2520request%2521'; //must be text, if you use Base64 or HEX then change hmacInputType on line 72 | |
var SigningKey = 'kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw&LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE'; | |
var hashedVal = calcHMAC(SignatureBaseString, SigningKey); | |
alert(hashedVal); | |
function calcHMAC(input, inputKey) { //MUST place this function below the block of yucky code above | |
//currently set up to take inputText an |
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
initSHA1(this); //onload must run this once | |
var HTTPMethod = 'POST'; | |
var requestURL = 'https://api.twitter.com/oauth/request_token'; | |
var APIKey = 'AjONvgAdbD8YWCtRn5U9yA'; //also known as oauth_consumer_key //from your app page on twitter dev site | |
var ConsumerSecret = 'jrcJKxvJ92NeeV48RL1lotN9PigbxCCbqUkKj237yio'; //from your app page on twitter dev site | |
var OAuthTokenSecret = ''; | |
var param = { | |
oauth_callback: rawurlencode('http://www.floppers.comyr'), |
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
initSHA1(this); //onload must run this once | |
var HTTPMethod = 'POST'; //HTTP Method | |
var requestURL = 'https://api.twitter.com/1/statuses/update.json'; //Base URL | |
var APIKey = 'AjONvgAdbD8YWCtRn5U9yA'; //also known as oauth_consumer_key //from your app page on twitter dev site | |
var ConsumerSecret = 'kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw'; //from your app page on twitter dev site | |
var OAuthTokenSecret = 'LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE'; | |
var param = { | |
status: 'Hello Ladies + Gentlemen, a signed OAuth request!', |
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
<div style="left: 10px; top: 10px;" class="roar-body"> | |
<div id="shipyard-hrtypyw7" style="opacity: 1;" class="roar warning"><div style="" class="roar-bg"></div><div class="roar-icon"></div><h3>Install Add-on Builder Helper</h3><p>To test this add-on, please install the <a id="install_addon_helper" href="https://addons.mozilla.org/firefox/downloads/latest/182410?src=external-builder">Add-on Builder Helper add-on</a></p></div> | |
<div id="shipyard-hrtypyw7" style="opacity: 1;" class="roar warning"><div style="" class="roar-bg"></div><div class="roar-icon"></div><h3>Install Add-on Builder Helper</h3><p>To test this add-on, please install the <a id="install_addon_helper" href="https://addons.mozilla.org/firefox/downloads/latest/182410?src=external-builder">Add-on Builder Helper add-on</a></p></div> | |
<div id="shipyard-hrtypyw7" style="opacity: 1;" class="roar warning"><div style="" class="roar-bg"></div><div class="roar-icon"></div><h3>Install Add-on Builder Helper</h3><p>To test this add-on, please install the <a |
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
Cu.import("resource://gre/modules/ctypes.jsm"); | |
var libc = ctypes.open("msvcrt.dll"); | |
var FILE = new ctypes.StructType("FILE").ptr; //made var otherwise in scratchpad cant run multiple times, this can be CONST its no issue | |
var fopen = libc.declare("fopen", // symbol name | |
ctypes.default_abi, // cdecl calling convention | |
FILE, // return type (FILE*) | |
ctypes.char.ptr, // first arg (const char*) | |
ctypes.char.ptr); // second arg (const char*) |
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
Cu.import("resource://gre/modules/ctypes.jsm"); | |
var libc = ctypes.open("msvcrt.dll"); | |
var struct_FILE = new ctypes.StructType("FILE"); //set to var only so can run multiple times in scratchpad, can change back to const | |
var fopen = libc.declare("fopen", // symbol name | |
ctypes.default_abi, // cdecl calling convention | |
struct_FILE.ptr, // return type (FILE*) | |
ctypes.char.ptr, // first arg (const char*) | |
ctypes.char.ptr); // second arg (const char*) |
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
const {interfaces: Ci, utils: Cu} = Components; | |
Cu.import('resource://gre/modules/Services.jsm'); | |
const ignoreFrames = true; | |
function addDiv(theDoc) { | |
Cu.reportError('addDiv host = ' + theDoc.location.host); | |
if (!theDoc) { Cu.reportError('no doc!'); return; } //document not provided, it is undefined likely | |
if(!(theDoc.location && theDoc.location.host.indexOf('github.com') > -1)) { Cu.reportError('location not match host:' + theDoc.location.host); return; } | |
//if (!theDoc instanceof Ci.nsIDOMHTMLDocument) { Cu.reportError('not html doc'); return; } //not html document, so its likely an xul document //you probably dont need this check, checking host is enought |
OlderNewer