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 characters
import java.io.*; | |
import java.util.*; | |
public class Main{ | |
public static void main(String[] argv) throws IOException,Exception{ | |
new Main().run(); | |
} | |
PrintWriter pw; |
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 characters
sc = new StreamTokenizer(new BufferedReader(new FileReader("input.txt"))); | |
sc.wordChars( 44, 46 ); | |
for (int i = 0; i < 10; i++) { | |
int token = sc.nextToken(); | |
switch (token) { | |
case StreamTokenizer.TT_EOF: | |
System.out.println("End of File encountered."); | |
break; | |
case StreamTokenizer.TT_EOL: |
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 characters
import java.io.*; | |
import java.math.BigInteger; | |
import java.util.*; | |
public class Main{ | |
public static void main(String[] argv) throws IOException,Exception{ | |
new Main().run(); | |
} | |
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 characters
import java.io.*; | |
import java.math.BigInteger; | |
import java.util.*; | |
public class Main{ | |
public static void main(String[] argv) throws IOException,Exception{ | |
new Main().run(); | |
} | |
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 characters
import java.io.*; | |
import java.math.BigInteger; | |
import java.util.*; | |
public class Main{ | |
public static void main(String[] argv) throws IOException,Exception{ | |
new Main().run(); | |
} | |
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 characters
import java.io.*; | |
import java.math.BigInteger; | |
import java.util.*; | |
public class Main{ | |
public static void main(String[] argv) throws IOException,Exception{ | |
new Main().run(); | |
} | |
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 characters
import java.io.*; | |
import java.util.*; | |
public class Main{ | |
public static void main(String[] argv) throws IOException,Exception{ | |
new Main().run(); | |
} | |
public void run() throws IOException,Exception{ |
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 characters
def self.for_classic(compilation = nil) | |
if compilation.nil? | |
classic_ids_query = sprintf('SELECT "books".id FROM "books" | |
INNER JOIN "books_products" ON "books_products".book_id = "books".id | |
INNER JOIN "products" ON "products".id = "books_products".product_id | |
WHERE (products.id = %d) | |
AND ("books"."status" IN (%s, %s))', Product.classic_product.id, "E'published'", "E'republishing'") | |
else | |
classic_ids_query = sprintf('SELECT "books".id FROM "books" | |
INNER JOIN "books_compilations" ON "books".id = "books_compilations".book_id |
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 characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# https://gist.github.com/boblail/5587579 | |
require 'benchmark' | |
require 'nokogiri' | |
require 'progressbar' | |
require 'tempfile' | |
class SqlRocket < Nokogiri::XML::SAX::Document |
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 characters
namespace :fias do | |
namespace :parse_xml do | |
class DumpCreator | |
# creates psql dump from template | |
attr_reader :target_file, :current_attributes | |
def initialize(target_file) | |
@target_file = target_file | |
target_file = File.open(target_file, 'a') | |
@stack = [] |