Skip to content

Instantly share code, notes, and snippets.

@rashivkp
rashivkp / split.rb
Created March 14, 2017 14:33 — forked from venj/split.rb
Split a image into two halves.
#!/usr/bin/env ruby
require "fileutils"
(puts "Usage: #{File.basename $0} widthxheight"; exit 0) if ARGV.size != 1
width, height = ARGV[0].split("x").collect(&:to_i)
(puts "Please enter a valid size."; exit 0) if ((width.to_i == 0) or (height.to_i == 0))
half_width = width / 2
FileUtils.cd("images") do
Dir['**/*'].each do |f|
@rashivkp
rashivkp / dump.sh
Last active August 29, 2015 14:09 — forked from cal/dump.sh
#!/bin/bash
credentials=''
database=''
TABLES=`mysql $credentials -B -N -e "select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='$database'"`
for table in $TABLES; do
echo -n "dumping $database.$table... "
if [[ $table == cache* ]]; then