Skip to content

Instantly share code, notes, and snippets.

@youpy
youpy / dot.emacs
Last active December 17, 2015 11:49
Expand abbreviations from the content of active tab on Google Chrome
;; dabbrev-expand
;; chrome のタブから補完
;; require clome-cli (https://github.com/prasmussen/chrome-cli)
(defadvice dabbrev-expand (around dabbrev-expand-chrome)
"Expand abbreviations from the content of active tab on Google Chrome"
(setq buf (get-buffer-create "*chrome-active-tab-content*"))
(with-current-buffer buf
(erase-buffer)
(call-process "chrome-cli" nil buf nil "execute" "document.body.innerText"))
ad-do-it)
@youpy
youpy / notify_facebook_feed_ticker.rb
Last active December 16, 2015 14:49
Notify new entry for Facebook's feed ticker
# require RubyCocoa
%w/ubygems grope pit terminal-notifier/.each {|g| require g }
def name(item)
elem = item.querySelector('.actorName') || item.querySelector('.passiveName')
elem.innerText.strip
end
def main
### Eclipse Workspace Patch 1.0
#P JDownloader
Index: src/jd/plugins/hoster/BandCampCom.java
===================================================================
--- src/jd/plugins/hoster/BandCampCom.java (revision 20104)
+++ src/jd/plugins/hoster/BandCampCom.java (working copy)
@@ -67,7 +67,8 @@
br.getPage(downloadLink.getDownloadURL());
if (br.containsHTML("(>Sorry, that something isn\\'t here|>start at the beginning</a> and you\\'ll certainly find what)")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
Regex filenameRegex = br.getRegex("<title>(.*?) \\| (.*?)</title>");
@youpy
youpy / gist:4643448
Last active December 11, 2015 18:39
midix for micron
require 'coremidi'
class MIDIX
def initialize
@destinations = CoreMIDI::Destination.all
end
def program_change(program_number, channel = 0)
puts(0b11000000 | channel, program_number)
end
@youpy
youpy / default.js
Created January 16, 2013 05:13
RIP_aaron for dotjs
// RIP aaron
var script = $('<script />').
attr('src', 'https://raw.github.com/fatlab/RIP_Aaron/master/RIP_aaron.js');
$('head').append(script);
@youpy
youpy / gist:4524305
Last active December 11, 2015 01:38
key mappings for vimium
map m previousTab
map n nextTab
map [ goBack
map ] goForward
unmap t
map t Vomnibar.activateInNewTab
@youpy
youpy / gist:4264945
Created December 12, 2012 04:50
create m4a with chapters
# -*- coding: utf-8 -*-
require 'scissor'
# https://github.com/youpy/chapter
require 'chapter'
duraton = 60
outfile = '/Users/youpy/Desktop/chapters.m4a'
@youpy
youpy / consolidate_repos.rb
Created November 30, 2012 05:57
consolidate two git repos
#!/usr/bin/env ruby
# -*- coding: utf-8; ruby -*-
# http://d.hatena.ne.jp/okinaka/20111010/1318211550
require 'shellwords'
def main
old = File.expand_path(ARGV[0])
new = File.expand_path(ARGV[1])
branch_name = Time.now.to_i.to_s
@youpy
youpy / gist:4129439
Created November 22, 2012 04:38
add ainote
# inspired by https://github.com/negipo/ainote
require 'scissor/echonest'
def ainote(dir)
Scissor(dir + '/%i.m4a' % rand(5))
end
def main
ainote_dir, source_file = ARGV
@youpy
youpy / reich.rb
Created November 16, 2012 12:29
reich
require 'scissor_utils'
include ScissorUtils
filename = ARGV.shift
num = 400
src = Scissor(filename)
pitch = ((src.duration * (num - 1)) / (src.duration * num)) * 100
save(