Skip to content

Instantly share code, notes, and snippets.

/*
javascript:FetchFullFeed:['http://gist.github.com/15651.txt',function(d,i,e){for(i=this.length;--i;d.body.appendChild(e))e=d.createElement('script'),e.src=this[i]].reverse()[0](document)
*/
with(document)!function(){
var list = body.insertBefore(createElement('ul'), body.firstChild);
list.style.cssText =
('position:fixed; top:5px; left:5px; z-index:999999;'+
'text-align:left; background-color:menu; color:menutext;'+
'width:auto; height:auto; max-height:none; max-width:none;'+
'margin:0; padding:5px; font:normal 14px monospace;'+
String fun(String fpath, List mods, Closure sorter){
def r = new File(fpath).text.trim().split(/\r?\n/)*.tokenize('\t')
mods.each{ r.(it.maximumNumberOfParameters==2?'eachWithIndex':'each') it }
[r.head(), *r.tail().sort(sorter)]*.join('\t').join('\n')
}
print fun('data.csv', [
{ it[0..3] = it[0, 2, 1, 3] },
{ a, i -> if(i){ [0, 3].each{ a[it] = a[it].toInteger() }; ++a[3] } },
]){ it[0] }
(defun show-bytes () (interactive)
(let ((fn (get-buffer-file-name)))
(message (concat "buffer: ~D"
(if fn (format nil " file: ~D" (file-length fn)) ""))
(buffer-size))))
(global-set-key #\C-b 'show-bytes)
// ==UserScript==
// @name google-one-touch
// @description Adds keyboard shortcuts to each entry.
// @namespace http://d.hatena.ne.jp/murky-satyr
// @include http://www.google.tld/*
// ==/UserScript==
var splinks = document.getElementById('mbEnd');
if(splinks) splinks.parentNode.removeChild(splinks);
addEventListener('load', function onload(){
(function addURIOpenerToCMenu(opts){
var mi = document.createElement('menuitem');
mi.setAttribute('label', opts.label);
mi.setAttribute('accesskey', opts.accesskey);
mi.opener = opts.opener;
mi.run = function run(){
var {path, args} = this.opener;
with(gContextMenu) var uri = isTextSelected
? getSelectedURI()
: (onLink ? linkURI : gBrowser.currentURI).spec;
// ==UserScript==
// @name WedataJSONInput
// @namespace http://d.hatena.ne.jp/murky-satyr
// @description Fills the form by prompting json text.
// @include http://wedata.net/databases/*/items/new
// @include http://wedata.net/items/*/edit
// ==/UserScript==
with(document) with(getElementById('item').appendChild(createElement('a'))){
href = 'javascript:';
innerHTML = '<b>[JSON]</b>';
(defun run-console () (interactive)
(launch-application
"cmd /k clear&&title cmd&&prompt $P$S[$D$S$T]$S$M$_$+$G$S"))
(defvar *last-command-cmd* "")
(defun command-cmd (cmd) (interactive "e> " :history0 'execute)
(execute-shell-command
(substitute-string (setq *last-command-cmd* cmd)
"\\?\\?" (or (get-buffer-file-name)
(buffer-name (selected-buffer))))
(defvar *twitter-auth* "user:pass")
(defun twitter-update-with-curl (stat) (interactive "sTwitter: ")
(let ((twit "-d source=curl http://twitter.com/statuses/update.json")
(stat (si::www-url-encode (map-internal-to-utf-8 stat)
nil "-0-9A-Za-z._~")))
(message "~D" (execute-shell-command
(format nil "curl -s -u ~A -d status=~A ~A"
*twitter-auth* stat twit)))))
(global-set-key #\C-\\ 'twitter-update-with-curl)
+function(pq, list){
const Yats = 'http://pcod.no-ip.org/yats/';
CmdUtils.CreateCommand({
name: "yats",
icon: 'http://twitter.com/favicon.ico',
takes: {'search formula': noun_arb_text},
modifiers: {'in': noun_type_language},
description: 'yet another twitter search'.link(Yats),
execute: function(inp, mod){ Utils.openUrlInBrowser(makeQ(inp, mod)) },
preview: function(pbl, inp, mod){
@satyr
satyr / jamazon.ubiq.js
Last active May 12, 2016 00:00
amazon.co.jp (Ubiquity 0.5.4+)
var Name = 'jamazon',
Jamazon = 'http://www.amazon.co.jp/',
ItemMax = 35,
Logo = '<a class="logo" href="'+ Jamazon +'" accesskey="0">'
+ '<img border="0" width="126" height="28" align="middle" src="'
+ 'http://g-ecx.images-amazon.com/images/G/09/gno/images/general/'
+ 'navAmazonLogoFooter._V28243234_.gif'
+ '"/></a>',
Base = '<style>\
.head {padding:0 0.4em}\