Skip to content

Instantly share code, notes, and snippets.

@RoxasShadow
RoxasShadow / oped.rb
Last active August 29, 2015 13:56
Given two .ass files, it creates a new file with the OP/ED lines of the first one replaced by the respective lines of the second one.
#! /usr/bin/env ruby
abort "usage: [ruby] #{File.basename $0} <ass> <op/ed>" if ARGV.length != 2
source = File.read(ARGV[0]).split(/\n/).reject(&:empty?)
lyrics = File.read(ARGV[1]).split(/\n/).reject { |line|
tag = line.split(?,)[3]
tag != 'OP' && tag != 'ED'
}
File.open("#{ARGV[0].split(?.)[0..-2].join}_OP_ED.ass", ?w) { |ass|
# A derpy way to implement Vigènere cipher using Array#next!
# problemotd.com of 2014/03/06
module ArrayNext
refine Array do
def next! # like Array#shift, but leaving the array untouched
if not defined? @ary
@ary = self
@ary_ = self.dup
@RoxasShadow
RoxasShadow / pigro_client.rb
Last active August 29, 2015 13:57
Sketch of Pigro's client. It is implemented in nonchosbatta/assonnato
##
# Copyright (c) 2014 Giovanni Capuano <[email protected]>
# Released under the MIT License
# http://opensource.org/licenses/MIT
##
require 'net/http'
require 'json'
require 'uri'
require 'net/http'
require 'optparse'
options = {}
OptionParser.new do |o|
o.on '-l', '--language LANG', 'Set a language' do |lang|
options[:lang] = lang
end
#--
# Copyright (c) 2014 Giovanni Capuano <[email protected]>
# Released under the MIT License
# http://opensource.org/licenses/MIT
#++
module Chapterable
extend ActiveSupport::Concern
included do
#!/usr/bin/env ruby
#--
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
# 0. You just DO WHAT THE FUCK YOU WANT TO.
#++
{
"bold_folder_labels": true,
"enable_hexadecimal_encoding": false,
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"font_size": 14,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
[
{ "keys": ["ctrl+shift+s"], "command": "stackoverflow_search_from_input"},
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["ctrl+up"], "command": "swap_line_up" },
{ "keys": ["ctrl+down"], "command": "swap_line_down" },
{ "keys": ["ctrl+d"], "command": "duplicate_line" },
{ "keys": ["ctrl+f"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["ctrl+g"], "command": "join_lines" },
{ "keys": ["ctrl+m"], "command": "markdown_preview", "args": { "target": "browser", "parser":"markdown" } }
@RoxasShadow
RoxasShadow / lacumparola.php
Created December 22, 2014 08:52
Put this script in `wp-content/plugins/lacumparola`. This will import all your posts made with [LaCumparola](https://github.com/RoxasShadow/LaCumparola) to WordPress.
<?php
/**
* Plugin Name: LaCumparola
* Plugin URI: http://omnivium.it
* Description: Import posts from LaCumparola
* Version: 1.0
* Author: Giovanni Capuano
* Author URI: http://www.giovannicapuano.net
*/
watchDir: "~/.watch"
refreshEvery: 10m
notifications:
enabled: true
series:
- name: Akatsuki no Yona
fansub: Horrible
res: 1080p
pattern: "[$fansub] $name - [$res]"