Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name mystella
// @author uenop
// @namespace http://uenop/
// @version $Last update: 2011/03/02 20:08:29 $
// @include http://www.nicovideo.jp/watch/*
// ==/UserScript==
(function() {
var key_comment='c';
#!env perl -w
use strict;
print "Hello, gisty!";
@m-ueno
m-ueno / youtube-kb.js
Created January 19, 2012 20:55
youtube-kb
// ==UserScript==
// @name youtube-kb
// @author uenop
// @namespace http://twitter.com/uenomasaru
// @include http://www.youtube.com/watch?*
// ==/UserScript==
(function() {
var time_seek = 15, tick_volume = 10, tick_volume2 = 20;
var key = {
@m-ueno
m-ueno / amazon-jp-shorten.js
Last active July 12, 2022 06:13
UserJS: Make amazon.co.jp product URL canonical
// ==UserScript==
// @name amazon-jp-shorten
// @author m-ueno
// @namespace https://gist.githubusercontent.com/m-ueno/4142488
// @version 1.0.1
// @match https://www.amazon.co.jp/*dp/*
// @match https://www.amazon.co.jp/*gp/*
// @match https://www.amazon.co.jp/*ASIN*
// @downloadURL https://gist.githubusercontent.com/m-ueno/4142488/raw
// @grant none
(defun replace-regexp-in-file (regexp to-str)
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t) ;; idiom
(replace-match to-str)))
"replace done")
(defun replace-japanese-periods-and-commas ()
(interactive)
(mapcar (lambda (pair)
(replace-regexp-in-file (car pair) (cadr pair)))
rc_file=~/.dotfiles/openstack.bash_completion
_update_ostack_completion() {
echo '' > $rc_file
for i in $@ ; do
echo "install: $i"
echo "\n# $i" >> $rc_file
curl -L "https://raw.github.com/openstack/python-${i}client/master/tools/${i}.bash_completion" >> $rc_file
done
}
curl -kL http://install.perlbrew.pl | bash
source ~/perl5/perlbrew/etc/bashrc
perlbrew install 5.16.3
perlbrew install-cpanm
git clone https://github.com/jedi4ever/sahara.git
cd sahara
bundle install
rake build
echo vagrant plugin install pkg/sahara-0.0.xx.gem
# https://github.com/sgruhier/rake_cap_bash_autocomplete/blob/master/rake_cap_bash_autocomplete.sh
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
_capcomplete() {
COMPREPLY=($(compgen -W "`cap -T 2>/dev/null| awk '{{ if ( $3 ~ /\#/ ) print $2}}'`" -- ${COMP_WORDS[COMP_CWORD]}))
return 0
}
complete -o default -o nospace -F _capcomplete cap
@m-ueno
m-ueno / threading.rb
Created October 17, 2013 00:17
http://www.jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil Appending to arrays is not thread-safe Very few things are implicitly thread-safe in Ruby. For example, appending to arrays:
array = []
5.times.map do
Thread.new do
1000.times do
array << nil
end
end
end.each(&:join)