Skip to content

Instantly share code, notes, and snippets.

View LavirtheWhiolet's full-sized avatar

Lavir the Whiolet LavirtheWhiolet

View GitHub Profile
@LavirtheWhiolet
LavirtheWhiolet / download-e621-pools.rb
Last active March 22, 2018 15:50
Script to download http://e621.net pools
#!/usr/bin/env ruby
# encoding: UTF-8
require 'open3'
require 'json'
require 'optparse'
require 'digest'
require 'fileutils'
require 'shellwords'
class Array
@LavirtheWhiolet
LavirtheWhiolet / xpath
Created April 19, 2016 08:57
Apply XPath query to an HTML/XML. More robust version of xpath utility from Ubuntu.
#!/usr/bin/ruby
require 'nokogiri'
require 'optparse'
# Parse args.
to_xml = lambda { |text| Nokogiri::HTML(text) }
to_string = lambda { |node| node.to_html }
OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename __FILE__} [options] xpath [file]"
opts.separator ""
@LavirtheWhiolet
LavirtheWhiolet / yaml
Created April 19, 2016 08:53
Prints the value under specified keys or indexes of the YAML file.
#!/usr/bin/env ruby
require 'yaml'
def usage
puts <<-USAGE
Usage: #{File.basename __FILE__} [options] file {keys|indexes}
Prints the value under specified keys or indexes of the YAML file.
Options:
#!/usr/bin/ruby
require 'optparse'
require 'shellwords'
# encoding: UTF-8
class String
def shellescape
Shellwords.shellescape self
end
#!/usr/bin/ruby
def sh(cmd)
if not system(cmd) then raise "Command failed: #{cmd}"; end
end
# ----
["cuebreakpoints", "shnsplit", "cuetag"].each { |prog|
@LavirtheWhiolet
LavirtheWhiolet / compress-images
Last active April 19, 2016 09:02
Compress PNG and GIF images to JPG or MP4.
#!/usr/bin/ruby
require 'find'
require 'fileutils'
require 'shellwords'
require 'stringio'
include FileUtils
class Condition
def initialize(&condition)
#!/bin/bash
function print_usage {
cat <<USAGE
Usage: $THIS_PROGRAM [pissing-args...] [-c|--continue] [-s|--save DIR]
[-l|--load DIR] [-h|--help] audio-files...
Plays audio files via http://anon.fm using Pissing (http://anon.fm/pissing/).
@LavirtheWhiolet
LavirtheWhiolet / gist:1670169
Created January 24, 2012 13:27
Game Developer Tools: Draft
TexturedPolygon2D:
(in development)
TexturedPolygon2D::Batch:
is: Singleton
Add(polygon:TexturedPolygon2D): void
# Draws this Batch using OpenGL and then clears it.
DrawAndClear(): void
# Remembers this Batch and replaces it with new one.