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 Node{ | |
| public char d;public boolean e; | |
| public LinkedList<Node>c; | |
| public Node(){} | |
| public Node(char a){d=a;e=Boolean.FALSE;c=new LinkedList<Node>();} | |
| public Node sub(char a){ | |
| int i; | |
| if(c.isEmpty()) return null; | |
| for(i=0;i<c.size();i++) | |
| if(c.get(i).d==a) return c.get(i); |
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
| import java.util.*; | |
| import java.io.*; | |
| public class Main{ | |
| public static int flag=0,m,n,dx[]={0,0,1,-1}; | |
| public static int dy[]={1,-1,0,0}; | |
| public static char wrd[]; | |
| static class S{char a;int p,x,y; | |
| S(){} | |
| S(char b,int pos,int c,int d){a=b;p=pos;x=c;y=d;} | |
| } |
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
| import java.util.*; | |
| import java.io.*; | |
| public class Main{ | |
| public static int flag=0,m,n,dx[]={0,0,1,-1}; | |
| public static int dy[]={1,-1,0,0}; | |
| public static char wrd[]; | |
| static class S{char a;int p,x,y; | |
| S(){} | |
| S(char b,int pos,int c,int d){a=b;p=pos;x=c;y=d;} | |
| } |
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
| hash={"1"=>"Narendra", "2"=>"Mangesh", "3"=>"Viru", "4"=>"Virendra", "5"=>"Genh"} | |
| z=[] | |
| err_msg="ruby #{__FILE__} <GET/SET> <key_to_search/key_to_set> <not_required/value_to_set>" | |
| if ARGV.length<2 && (ARGV[0]!="GET" || ARGV[0]!="SET") | |
| puts err_msg | |
| exit | |
| end | |
| if ARGV[0]=="SET" && ARGV.length!=3 | |
| puts err_msg | |
| exit |
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 'mechanize' | |
| a = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari'} | |
| url=your_subscription_url | |
| doc=nil | |
| a.get url | |
| for i in 1..420 | |
| begin | |
| url="http://railscasts.com/episodes/#{i}" | |
| a.get url do |page| | |
| doc=page.parser |
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
| ['gmail','terminal-notifier'].each {|x| require x} | |
| username = 'emailid' | |
| password = %x(security 2>&1 find-internet-password -ga #{username} | grep password | cut -d '"' -f2).strip | |
| gmail = Gmail.new(username, password) | |
| puts "logged in to gmail" | |
| path = "#{ENV['HOME']}/.gmail_notifier_last_running_time" | |
| last_running_time = File.exists?(path) ? Time.now.to_i : File.read(path).strip.to_i | |
| flag, idx = 0, 0 | |
| search_queries = [[:subject, "sweets"],[:subject, "chocolates"],[:body, "sweets"],[:body, "chocolates"]] | |
| while flag == 0 |
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 'mechanize' | |
| require 'json' | |
| ALBUM_URL = ARGV[0] | |
| ALBUM_NAME = ARGV[1] | |
| SIZE_TO_DOWNLOAD = ARGV[2] | |
| if !ALBUM_URL || !ALBUM_NAME | |
| puts "Usage: ruby #{__FILE__} <album_url> <album_name> [size_to_download_image]" | |
| puts "size_to_download_image default 'o' which is original. Other available options in descending order of size k, h, l, c, m etc." | |
| exit! |
OlderNewer