Skip to content

Instantly share code, notes, and snippets.

arantius arantius

Block or report user

Report or block arantius

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 everything-red.css
* { color: red !important; }
@arantius
arantius / gm-get-set-demo-with-polyfill.user.js
Last active May 2, 2018
A simple persistent value test user script
View gm-get-set-demo-with-polyfill.user.js
'use strict';
// ==UserScript==
// @name GM set/get demo
// @description Exercises both GM.getValue() and GM.getValue(). Logs a counter which goes up by one, at each page load.
// @grant GM.getValue
// @grant GM_getValue
// @grant GM.setValue
// @grant GM_setValue
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// ==/UserScript==
View gm-addstyle.js
function GM_addStyle(aCss) {
'use strict';
let head = document.getElementsByTagName('head')[0];
if (head) {
let style = document.createElement('style');
style.setAttribute('type', 'text/css');
style.textContent = aCss;
head.appendChild(style);
return style;
}
@arantius
arantius / long-name-no-space.user.js
Created Jan 26, 2018
User scripts with long @name values.
View long-name-no-space.user.js
// ==UserScript==
// @name This_user_script_has_a_terribly_long_name_and_is_likely_to_break_UI_that_hasn't_been_crafted_specifically_to_handle_long_names.
// @grant none
// ==/UserScript==
// No_op.
View README.md

Check out this repository/download this ZIP. Run:

$ npm i --save-dev
$ npm test

> sinon-chrome-webext-test@0.0.1 test /.../sinon-chrome-webext-test
> karma start karma.conf.js

Firefox 57.0.0 (Ubuntu 0.0.0) ERROR
  ReferenceError: browser is not defined
@arantius
arantius / serve-user-script-slow.py
Last active Feb 16, 2018
Serves a user script, slowly
View serve-user-script-slow.py
#!/usr/bin/env python
import time
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
PORT = 8000
USER_JS = """// ==UserScript==
// @name Red Border
@arantius
arantius / red-border.user.js
Created Sep 7, 2017
A super simple user script with an unobtrusive way of being clear that it's running.
View red-border.user.js
// ==UserScript==
// @name Red Border
// @description A super simple user script with an unobtrusive way of being clear that it's running.
// @namespace test
// @include http*
// @version 1
// @grant none
// ==/UserScript==
document.body.style.border = '3px dashed red';
View warnings.txt
C:\Users\t-bone\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src\WiFiClientSecure.cpp: In function 'int ax_port_read(int, uint8_t*, size_t)':
C:\Users\t-bone\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src\WiFiClientSecure.cpp:539:53: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (!_client || _client->state() != ESTABLISHED && !_client->getSize()) {
^
C:\Users\t-bone\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266mDNS\ESP8266mDNS.cpp: In member function 'void MDNSResponder::_parsePacket()':
View GM_[gs]etValue_Bench.user.js
// ==UserScript==
// @name GM_[gs]etValue Bench
// @namespace https://github.com/arantius
// @description Test performance of lots of get/set value calls.
// @include http:*
// @version 1
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// ==/UserScript==
@arantius
arantius / index.php
Created Feb 3, 2016
Test script for online edit of `.user.js` files.
View index.php
<?
////////////////////////////////////////////////////////////
// This proof of concept script is FULL OF SECURITY ISSUES.
// Don't use it, don't install it, don't expose it anywhere.
////////////////////////////////////////////////////////////
// Context: https://github.com/greasemonkey/greasemonkey/issues/2280
////////////////////////////////////////////////////////////
if (isset($_POST['file'])) {
$fp = fopen($_GET['file'], 'wb');
You can’t perform that action at this time.