Skip to content

Instantly share code, notes, and snippets.

View rohitkadam19's full-sized avatar
🏠
Working from home

Rohit Kadam rohitkadam19

🏠
Working from home
View GitHub Profile
@rohitkadam19
rohitkadam19 / curl-request
Created May 25, 2017 11:10
Curl request with multiple file
curl -X POST http://<host>/certifications/check -H 'accept: application/v1'
-H 'cache-control: no-cache'
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
-F 'check[cert_type]=hardware'
-F 'check[source]=files'
-F 'check[files][][path]=proc'
-F 'check[files][][content]=@/Users/rkadam/Downloads/name'
-F 'check[files][][path]=etc'
-F 'check[files][][content]=@/Users/rkadam/Downloads/release'
@rohitkadam19
rohitkadam19 / test.html
Last active March 2, 2017 10:10
SVG HTML
<donut-chart data="donutData" width="250" height="250" colors="colors" center-text="10" center-text-sub="Count" animate-hover="true" donut-click="updateBarChart" class="ng-isolate-scope">
<svg width="250" height="250">
<g transform="translate(125, 125)">
<path fill="#CE4B99" d="M0.5749976041696607,-124.99867750402481A125,125 0 1,1 -99.9390966489291,-75.08113585312898L-76.03652369768226,-56.95126920422234A95,95 0 1,0 0.5749976041696777,-94.99825986698494Z"></path>
<path fill="#9957A0" d="M-91.27662597098112,-69.95411032493814A115,115 0 0,1 -52.17846357747278,-102.48125652378754L-43.193039405111826,-84.61300932450315A95,95 0 0,0 -75.3415580466597,-57.86751792760604Z"></path>
<path fill="#6564AD" d="M-51.15105919092103,-102.99790844306933A115,115 0 0,1 -10.258563584133336,-114.54152903288089L-8.574063296132389,-94.6122901033154A95,95 0 0,0 -42.16563501856003,-85.12966124378497Z"></path>
<path fill="#377BBC" d="M-9.112654460059119,-114.638385930244A115,115 0 0,1 -0.5749976041695681,-
@rohitkadam19
rohitkadam19 / autoscale_sample.py
Last active July 21, 2016 08:35 — forked from liamf/autoscale_sample
Demonstrates using patched boto to create an autoscaling group of servers, scaled up/down by CPU Utilisation
#################################################################################
# Import modules
#################################################################################
import os
import time
import sys
import socket
import string
@rohitkadam19
rohitkadam19 / launch_safari.rb
Created September 9, 2013 05:08
Launch safari using appium
require 'selenium-webdriver'
capabilities = {
'browserName' => 'iOS',
'platform' => 'Mac',
'version' => '6.1',
'app' => 'Safari'
}
# Started Appium using appium app.
@rohitkadam19
rohitkadam19 / drag_and_drop_fail.rb
Last active December 19, 2015 04:49
Drag and drop doesn't work with selenium 2.33 and firefox 21.0
require 'selenium-webdriver'
browser = Selenium::WebDriver.for :firefox
browser.get 'http://example.com'
a = browser.find_element(:xpath, "//div[@labelname='Label 1']/div")
b = browser.find_element(:id, 'labelList')
browser.action.drag_and_drop(a, b).perform
# Output
# This does not perform any action and also does not return any error.
@rohitkadam19
rohitkadam19 / rubyracer_error
Created May 15, 2013 19:25
Error while bundle install in rails project. Therubyracer giving problem.
Installing therubyracer (0.11.0beta1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/rohit/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb
checking for main() in -lpthread... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
@rohitkadam19
rohitkadam19 / protected_works.rb
Last active December 15, 2015 00:19
How protected work in ruby
class Test
def call_print
puts "call print me"
print_me
end
protected
def print_me
puts "print me"
end
end
@rohitkadam19
rohitkadam19 / timeout_error.rb
Created November 21, 2012 10:45
Timeout error
require 'selenium-webdriver'
$browser = Selenium::WebDriver.for :remote, :url => "http://10.10.10.105:3001/wd/hub", :desired_capabilities => :ipad
$browser.get ("http://10.10.10.245:58894/test?name=ios_data")
sleep 20
$browser.find_element(:id => "apiReady") # This line gives the timeout error
-Output-
Exception `Errno::EAGAIN' at /Users/neerajapte/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:135 - Resource temporarily unavailable - read would block
Exception `Timeout::Error' at /Users/neerajapte/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:140 - Timeout::Error
@rohitkadam19
rohitkadam19 / selenium_on_ipad_ruby.rb
Created June 28, 2012 06:04
Selenum webdriver on ipad real device
# Code ---
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :remote, :url => "http://10.10.10.55:3001/wd/hub", :desired_capabilities => :ipad
# Output ---
=begin
URI::InvalidURIError: the scheme http does not accept registry part: (null):(null) (or bad hostname?)
from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/generic.rb:199:in `initialize'
from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/http.rb:78:in `initialize'
from /Users/rohit/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/uri/common.rb:177:in `new'