Last active
June 26, 2017 16:59
Revisions
-
saetia revised this gist
Jun 26, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ ruby -e "$(curl -fsSkL https://gist.githubusercontent.com/saetia/2369908/raw/4bf9a6d36060582e69f02c314f66449971a7bb11/parse.rb)" /Users/Joel/site.db.121010.dump ruby parse.rb site.120411.dump -
saetia revised this gist
Oct 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ ruby -e "$(curl -fsSkL raw.github.com/gist/2369908/cd90a23b10d224284efe8dfdd5ccd3d3d328600c/parse.rb)" /Users/Joel/site.db.121010.dump ruby parse.rb site.120411.dump -
saetia revised this gist
Oct 10, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,11 +13,11 @@ d = File.new(dumpfile, "r") outfile = false table = "" directory = File.basename(dumpfile).gsub(/[^0-9a-z\.\_]/i, '')+'.tables' Dir.mkdir(directory) unless File.directory?(directory) while (line = d.gets) if line =~ /^-- Table structure for table .(.+)./ table = $1.gsub(/[^0-9a-z\.\_]/i, '') puts("\033[32mfound\033[0m #{table}\n") outfile = File.new("#{directory}/#{table}.sql", "w") end -
saetia revised this gist
Oct 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ ruby -e "$(curl -fsSkL raw.github.com/gist/2369908/6fe8fdc1c20f97c431cb9326c6ccc78effb9bd7b/parse.rb)" /Users/Joel/site.db.121010.dump ruby parse.rb site.120411.dump -
saetia revised this gist
Oct 10, 2012 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,9 +17,7 @@ Dir.mkdir(directory) unless File.directory?(directory) while (line = d.gets) if line =~ /^-- Table structure for table .(.+)./ table = $1.gsub(/[^0-9a-z]/i, '') puts("\033[32mfound\033[0m #{table}\n") outfile = File.new("#{directory}/#{table}.sql", "w") end -
saetia revised this gist
Oct 10, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,8 @@ Dir.mkdir(directory) unless File.directory?(directory) while (line = d.gets) if line =~ /^-- Table structure for table .(.+)./ table = $1 table.gsub(/[^0-9a-z]/i, '')! puts("\033[32mfound\033[0m #{table}\n") outfile = File.new("#{directory}/#{table}.sql", "w") -
saetia revised this gist
Oct 10, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,8 @@ Dir.mkdir(directory) unless File.directory?(directory) while (line = d.gets) if line =~ /^-- Table structure for table .(.+)./ table = $1.gsub(/[^0-9a-z]/i, '')! puts("\033[32mfound\033[0m #{table}\n") outfile = File.new("#{directory}/#{table}.sql", "w") end -
saetia revised this gist
Oct 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ Dir.mkdir(directory) unless File.directory?(directory) while (line = d.gets) if line =~ /^-- Table structure for table .(.+)./ table = $1.gsub(/[^0-9a-z]/i, '') puts("\033[32mfound\033[0m #{table}\n") outfile = File.new("#{directory}/#{table}.sql", "w") end -
saetia revised this gist
Oct 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ d = File.new(dumpfile, "r") outfile = false table = "" directory = File.basename(dumpfile).gsub(/[^0-9a-z]/i, '')+'.tables' Dir.mkdir(directory) unless File.directory?(directory) while (line = d.gets) if line =~ /^-- Table structure for table .(.+)./ -
saetia revised this gist
Oct 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ d = File.new(dumpfile, "r") outfile = false table = "" directory = File.basename(dumpfile).gsub(/[^0-9a-z ]/i, '')+'.tables' Dir.mkdir(directory) unless File.directory?(directory) while (line = d.gets) if line =~ /^-- Table structure for table .(.+)./ -
saetia revised this gist
Oct 10, 2012 . 2 changed files with 3 additions and 33 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,32 +0,0 @@ This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,3 @@ ruby -e "$(curl -fsSkL raw.github.com/gist/2369908/ee883b0eb427b43335ba31eb3fb9e59eaec7c2d2/parse.rb)" /Users/Joel/site.db.121010.dump ruby parse.rb site.120411.dump -
saetia revised this gist
Apr 12, 2012 . 1 changed file with 32 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #!/usr/bin/perl -w use strict; my $dump_file = shift @ARGV; my $out_dump_file = 'stripped_dump.sql'; open DUMP, "<$dump_file" or die $!; open OUT, ">$out_dump_file" or die $!; my @required_tables = @ARGV; my $table_dump_started = 0; while (<DUMP>){ if (index($_, 'CREATE TABLE') >= 0){ $table_dump_started = 0; foreach my $table (@required_tables){ if (index($_, "`$table`") >= 0){ $table_dump_started = 1; last; } } } print OUT if $table_dump_started; } close OUT; close DUMP; -
saetia revised this gist
Apr 12, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,11 +13,13 @@ d = File.new(dumpfile, "r") outfile = false table = "" directory = File.basename(dumpfile)+'.tables' Dir.mkdir(directory) unless File.directory?(directory) while (line = d.gets) if line =~ /^-- Table structure for table .(.+)./ table = $1 puts("\033[32mfound\033[0m #{table}\n") outfile = File.new("#{directory}/#{table}.sql", "w") end if table != "" && outfile outfile.syswrite line -
saetia created this gist
Apr 12, 2012 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ ruby parse.rb metropoliscoffee.db.120411.dump This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/usr/bin/ruby if ARGV.length == 1 dumpfile = ARGV.shift else puts("\033[31mhow to:\033[0m ruby parse.rb mysql.dump\n") exit 1 end STDOUT.sync = true if File.exist?(dumpfile) d = File.new(dumpfile, "r") outfile = false table = "" while (line = d.gets) if line =~ /^-- Table structure for table .(.+)./ table = $1 puts("\033[32mfound\033[0m #{table}\n") outfile = File.new("#{table}.sql", "w") end if table != "" && outfile outfile.syswrite line end end end