Skip to content

Instantly share code, notes, and snippets.

# Credit: https://github.com/mooz/xkeysnail/blob/bf3c93b4fe6efd42893db4e6588e5ef1c4909cfb/example/config.py#L62-L125
shared:
terminals: &terminals
- gnome-terminal-server
- qterminal
- Com.github.amezin.ddterm
- emacs
virtual_modifiers:
- CapsLock
// avault2mame.js - convert arcade game data in Atari Vault to older MAME ROM sets
//
// Usage:
// node avault2mame.js [ROM directory]
// (ex. on Linux) node avault2mame.js ~/.steam/steam/steamapps/common/Atari\ Vault/AtariVault_Data/StreamingAssets/FOCAL_Emulator
//
// Requirements:
// - Node.js v6 or later
// - [Microsoft Windows] .NET Framework 4.5 or later (included in Windows 8/10)
// - [Linux] /usr/bin/zip
// dotemu2mame.js - convert data of games ported by DotEmu to MAME ROM sets
//
// Usage:
// node dotemu2mame.js [ROM directory]
//
// Requirements:
// - Node.js v6 or later
// - [Microsoft Windows] .NET Framework 4.5 or later (included in Windows 8/10)
// - [Linux] /usr/bin/zip
//
@cxx
cxx / mangaz-bookshelf.user.js
Created August 9, 2015 02:36
マンガ図書館Zのサムネイルから本棚に登録
// ==UserScript==
// @name サムネイルから本棚に登録
// @namespace http://twitter.com/cxx
// @include http://www.mangaz.com/*
// @include http://r18.mangaz.com/*
// @version 0.1.0
// ==/UserScript==
"use strict";
@cxx
cxx / 3moji.rb
Created May 19, 2014 12:57
SUPER IMPORTANT 3文字
#!/usr/bin/env ruby
require 'optparse'
fg = "\u{2b1c}"
bg = "\u{2139}"
opt = OptionParser.new
opt.on("-f CHAR") {|v| fg = v[0] }
opt.on("-b CHAR") {|v| bg = v[0] }
opt.parse!(ARGV)
#!/usr/bin/env ruby
require 'open-uri'
require 'RMagick'
include Magick
palette = Hash[ *(
[ ["000000", "\u{2660}" ], ["157569", "\u{1f5fd}"], ["226699", "\u{1f17f}"],
["231f20", "\u{2b1b}" ], ["292f33", "\u{1f3b1}"], ["3b88c3", "\u{2139}" ],
["4288c1", "\u{1f53d}"], ["553986", "\u{1f47e}"], ["55acee", "\u{1f6b9}"],
["58595b", "\u{1f3a5}"], ["5c913b", "\u{264a}" ], ["5dadec", "\u{1f499}"],
@cxx
cxx / fix-ttf-weight.rb
Created February 23, 2014 07:43
フォントのweight値を書き換える
#!/usr/bin/env ruby
fail unless ARGV.length == 2
file = ARGV[0]
weight = ARGV[1].to_i
open(file, "r+b:ASCII-8BIT") do |io|
ver, ntables, srange, eselector, rshift = io.read(12).unpack("Nn*")
fail unless Math.log2(ntables).floor == eselector and
(2**eselector)*16 == srange and
@cxx
cxx / tv.rb
Created September 22, 2012 06:37
EasyCAP
#!/usr/bin/env ruby
Dir.chdir("#{ENV['HOME']}/Pictures")
rest = 5
device = loop do
dev = Dir["/dev/video*"].first
rest -= 1
break dev if dev || rest == 0
sleep(5)
end
exit(false) unless device
@cxx
cxx / .xsession-errors
Created April 27, 2012 11:04
Unable to install GNOME extensions from extensions.gnome.org
JS ERROR: !!! Exception was: TypeError: info is null
JS ERROR: !!! lineNumber = '83'
JS ERROR: !!! fileName = '"/usr/share/gnome-shell/js/ui/extensionSystem.js"'
JS ERROR: !!! stack = '"([object _private_Soup_SessionAsync],[object _private_Soup_Message])@/usr/share/gnome-shell/js/ui/extensionSystem.js:83
"'
JS ERROR: !!! message = '"info is null"'
@cxx
cxx / resize-agif.rb
Created December 2, 2011 16:50
diet animated GIF
require 'RMagick'
module DietGIF
MAX_BYTESIZE = 1024 * 1024
MAX_SIZE = [500, 700]
MID_SIZE = [400, 600]
MIN_SIZE = [250, 400]
MIN_COLORS = 32