This file contains hidden or 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/ruby | |
| file = 'test.txt' | |
| split_line_size = 3 | |
| file_cnt = 0 | |
| out = open('dummy.txt', 'w') | |
| open(file).each_with_index do |line, i| | |
| if i % split_line_size == 0 | |
| out.close unless out.closed? | |
| out = open("split#{file_cnt}.txt", 'w') |
This file contains hidden or 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/perl | |
| use strict; | |
| use warnings; | |
| my $file = 'test.txt'; | |
| my $split_line = 3; | |
| my $cnt = 0; | |
| my $file_cnt = 0; | |
| open IN, $file or die $!; |
This file contains hidden or 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
| --- old/pty.c 2011-08-13 16:22:42.000000000 +0900 | |
| +++ new/pty.c 2011-08-13 16:28:31.000000000 +0900 | |
| @@ -33,11 +33,6 @@ | |
| # include <sys/ioctl.h> | |
| #endif | |
| -/* for solaris 2.1, Unixware (SVR4.2) and possibly others */ | |
| -#ifdef HAVE_SVR4_PTYS | |
| -# include <sys/stropts.h> | |
| -#endif |
This file contains hidden or 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
| # -*- coding: UTF-8 -*- |
This file contains hidden or 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
| re = /(.*)\s\((.*)\)/ | |
| list=`gem list` | |
| # install | |
| list.each_line{|line| _,gem,versions=line.match(re).to_a; versions.split(', ').each{|ver| puts "gem install #{gem} -v=#{ver}"}} | |
| # uninstall | |
| list.each_line{|line| _,gem,_=line.match(re).to_a;puts "gem uninstall -a -I -x #{gem}"} |
This file contains hidden or 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
| require 'rubygems' | |
| require 'tmail' | |
| require 'net/smtp' | |
| require 'base64' | |
| module MyProject | |
| class AttachedEmail | |
| SMTP_HOST = 'localhost' | |
| def initialize |
This file contains hidden or 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
| class StringUtil | |
| def self.split_by_size(str, max_byte_size) | |
| length, bytes = 0, 0 | |
| str.each_char do |char| | |
| char_size = multi_bytes?(char)? 2 : 1 | |
| break if (bytes + char_size) > max_byte_size | |
| bytes += char_size | |
| length += 1 | |
| end | |
| str[0, length] |
This file contains hidden or 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
| -- 文字コード | |
| SELECT VALUE FROM NLS_DATABASE_PARAMETERS | |
| WHERE PARAMETER='NLS_CHARACTERSET' | |
| -- lock | |
| SELECT A.SQL_TEXT,A.ADDRESS FROM | |
| V$SQLAREA A,V$SESSION B WHERE A.ADDRESS = B.SQL_ADDRESS | |
| AND B.SID = ANY(SELECT SID FROM V$LOCK WHERE TYPE IN ('TX','TM')); | |
| --SELECT * FROM V$SESSION |
This file contains hidden or 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
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'pp' | |
| class RailsCommiters | |
| def initialize(url) | |
| @url = url | |
| end | |
| def extract_ranking |
This file contains hidden or 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
| i=1; while [ $i -ne 31 ]; do sudo mkdir $i; i=$(( $i + 1 )); done |