Revisions
-
bmfurtado revised this gist
Apr 20, 2013 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,8 @@ on run argv return end if set rightArrow to ASCII character 29 set numServers to count serverList set numHorizontal to (round (numServers ^ 0.5) rounding up) @@ -38,7 +40,7 @@ on run argv repeat createdPanels times -- re-evaluate number of vertical panels we need set numVertical to (round((numServers-createdPanels)/(numHorizontal-splitColumns)) rounding up) + 1 tell i term application "System Events" to keystroke rightArrow using {option down, command down} repeat numVertical - 1 times if createdPanels is less than numServers tell i term application "System Events" to keystroke "d" using {command down, shift down} -
bmfurtado revised this gist
Apr 16, 2013 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,9 +15,7 @@ on run argv set numServers to count serverList set numHorizontal to (round (numServers ^ 0.5) rounding up) set createdPanels to 1 @@ -34,19 +32,24 @@ on run argv set createdPanels to createdPanels + 1 end repeat set splitColumns to 0 -- split each of the panels vertically repeat createdPanels times -- re-evaluate number of vertical panels we need set numVertical to (round((numServers-createdPanels)/(numHorizontal-splitColumns)) rounding up) + 1 tell i term application "System Events" to keystroke "]" using {command down} repeat numVertical - 1 times if createdPanels is less than numServers tell i term application "System Events" to keystroke "d" using {command down, shift down} set createdPanels to createdPanels + 1 end if end repeat set splitColumns to splitColumns+1 end repeat -- open ssh sessions-- repeat with loopIndex from 1 to numServers set currentServer to item loopIndex of serverList tell item loopIndex of sessions to write text "ssh " & currentServer end repeat -
bmfurtado revised this gist
Apr 16, 2013 . 1 changed file with 13 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,8 @@ #!/usr/bin/osascript -- Launche multiple SSH session -- completely rewritten but inspired by github:xgdlm/iterm2-cssh on run argv set serverList to argv @@ -16,8 +15,9 @@ on run argv set numServers to count serverList -- number of panels we should end up with set numHorizontal to (round (numServers ^ 0.5) rounding up) set numVertical to (round (numServers / numHorizontal) rounding up) set createdPanels to 1 @@ -37,20 +37,23 @@ on run argv -- split each of the panels vertically repeat createdPanels times tell i term application "System Events" to keystroke "]" using {command down} repeat numVertical - 1 times if createdPanels is less than (count serverList) tell i term application "System Events" to keystroke "d" using {command down, shift down} set createdPanels to createdPanels + 1 end if end repeat end repeat -- open ssh sessions-- repeat with loopIndex from 1 to (count serverList) set currentServer to item loopIndex of serverList tell item loopIndex of sessions to write text "ssh " & currentServer end repeat -- introducing delay to avoid weirdness delay 1 tell i term application "System Events" to keystroke "I" using {command down, shift down} end tell -
bmfurtado revised this gist
Apr 16, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ on run argv activate set myterm to (make new terminal) tell myterm launch session "Default Session" -- create the horizontal panels repeat numHorizontal - 1 times -
bmfurtado revised this gist
Apr 16, 2013 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ on run argv -- Number of horizontal splits set numHorizontal to (round (numServers / 2) rounding up) set createdPanels to 1 tell application "iTerm" @@ -31,24 +31,24 @@ on run argv -- create the horizontal panels repeat numHorizontal - 1 times tell i term application "System Events" to keystroke "d" using {command down} set createdPanels to createdPanels + 1 end repeat -- split each of the panels vertically repeat createdPanels times tell i term application "System Events" to keystroke "]" using {command down} tell i term application "System Events" to keystroke "d" using {command down, shift down} set createdPanels to createdPanels + 1 end repeat if createdPanels is greater than (count serverList) then tell i term application "System Events" to keystroke "w" using {command down} end if -- open ssh sessions-- repeat with loopIndex from 1 to (count serverList) set currentServer to item loopIndex of serverList tell item loopIndex of sessions to write text "ssh " & currentServer end repeat tell i term application "System Events" to keystroke "I" using {command down, shift down} -
bmfurtado revised this gist
Apr 16, 2013 . 1 changed file with 6 additions and 11 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/usr/bin/osascript -- Launche multiple SSH session -- simplified and (hopefully more readable) version of github:xgdlm/iterm2-cssh -- retrieve command line arguments on run argv @@ -17,7 +17,7 @@ on run argv set numServers to count serverList -- Number of horizontal splits set numHorizontal to (round (numServers / 2) rounding up) set createdPanel to 1 @@ -29,7 +29,7 @@ on run argv launch session "distantssh" -- create the horizontal panels repeat numHorizontal - 1 times tell i term application "System Events" to keystroke "d" using {command down} set createdPanel to createdPanel + 1 end repeat @@ -41,14 +41,9 @@ on run argv set createdPanel to createdPanel + 1 end repeat if createdPanel is greater than (count serverList) then tell i term application "System Events" to keystroke "w" using {command down} end if -- open ssh sessions repeat with loopIndex from 1 to (count serverList) -
bmfurtado created this gist
Apr 15, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,63 @@ #!/usr/bin/osascript -- Launche multiple SSH session -- simplified and (hopefully more readable) fork of github:xgdlm/iterm2-cssh -- retrieve command line arguments on run argv set serverList to argv -- Print help if no servers are given if (count serverList) = 0 log("usage: iterm2-cssh [user@]hostname ...") return end if set numServers to count serverList -- Number of horizontal splits set numHorizontal to (round (numServers / 2)) + 1 set createdPanel to 1 tell application "iTerm" activate set myterm to (make new terminal) tell myterm launch session "distantssh" -- create the horizontal panels repeat numHorizontal times tell i term application "System Events" to keystroke "d" using {command down} set createdPanel to createdPanel + 1 end repeat -- split each of the panels vertically repeat createdPanel times tell i term application "System Events" to keystroke "]" using {command down} tell i term application "System Events" to keystroke "d" using {command down, shift down} set createdPanel to createdPanel + 1 end repeat repeat with loopIndex from 1 to createdPanel if loopIndex is less than or equal to (count serverList) then set theChoice to item loopIndex of serverList else -- remove any extra possible windows tell i term application "System Events" to keystroke "w" using {command down} end if end repeat -- open ssh sessions repeat with loopIndex from 1 to (count serverList) set theChoice to item loopIndex of serverList tell item loopIndex of sessions to write text "ssh " & theChoice end repeat tell i term application "System Events" to keystroke "I" using {command down, shift down} end tell end tell end run