-
-
Save rocel/45cd54f7dfb1056d1a90f9946566c198 to your computer and use it in GitHub Desktop.
Revisions
-
addyosmani revised this gist
Apr 3, 2017 . 1 changed file with 5 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 @@ -2,9 +2,13 @@ If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md Windows and Mac users might find using Justin Ribeiro's [Docker setup](https://t.co/wyVjzUVmBe) useful here while full support for these platforms is being worked out. You can use `chrome --headless` on Linux as of M57 but note you'll need to build the binaries yourself for now. The metabug for adding headless mode to Chromium is [over here](https://bugs.chromium.org/p/chromium/issues/detail?id=546953). Otherwise, if you're on Ubuntu or working with a Linux VM that isn't working with Linux: ## Step 1: Install the Ubuntu dependencies needed: -
addyosmani revised this gist
Apr 3, 2017 . 1 changed file with 5 additions and 3 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,8 +1,10 @@ # Update If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md The metabug for adding headless mode to Chromium is [over here](https://bugs.chromium.org/p/chromium/issues/detail?id=546953). If you're on Ubuntu or working with a Linux VM... ## Step 1: Install the Ubuntu dependencies needed: @@ -31,7 +33,7 @@ Start and open a page: xvfb-run --server-args='-screen 0, 1024x768x16' google-chrome -start-maximized http://www.example.com > /dev/null & ``` # If you're on Windows.. Use [Desktops](http://technet.microsoft.com/en-us/sysinternals/cc817881.aspx) from the MS SysInternals package. You can spawn your Chrome process directly from the "hidden" desktop and keep it working there (I have not personally tested this). -
addyosmani revised this gist
Oct 6, 2016 . 1 changed file with 4 additions and 0 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,3 +1,7 @@ # Update If you're looking at this in 2016, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md #If you're on Ubuntu or working with a Linux VM... ## Step 1: Install the Ubuntu dependencies needed: -
addyosmani revised this gist
Apr 8, 2013 . 2 changed files 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 @@ -34,4 +34,4 @@ Use [Desktops](http://technet.microsoft.com/en-us/sysinternals/cc817881.aspx) fr #Other options... You could try spawning Chrome as a child process using something like Node.js and piping the output back to the terminal. See runChrome.js for an example of how to do this (todo: update to latest Express). File renamed without changes. -
addyosmani revised this gist
Apr 8, 2013 . 2 changed files with 51 additions and 0 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 @@ -0,0 +1,50 @@ var express = require('express'); var http = require('http'); var cp = require('child_process'); var port = 3000; var app = express(); //var app = express(); //var server = http.createServer(app); var chrome_count = 0; app.get('/', function(req, res){ startChrome(chrome_count++,9222,function chromeStared(err,id,chrome){ res.send('Chrome '+id+' Started\r\n'); console.log('Simulating some data parsing'); setTimeout(function(){ console.log('Shutdown chrome '+id); chrome.kill('doh!'); },1000); }); }); app.listen(port); console.log('Server is listening on port ' + port); function startChrome(id,port,callback){ var terminal = cp.spawn('bash'); var chrome = {}; terminal.on('exit', function (code) { console.log('Starting chrome'); chrome = cp.spawn('/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome',[ '--remote-debugging-port='+port, '--user-data-dir=/Volumes/DATA/repos/scrapper/userdata', 'http://www.chrome.com' ]); callback(null,id,chrome); }); setTimeout(function() { console.log('Sending stdin to terminal'); //terminal.stdin.write('echo "Hello $USER"'); terminal.stdin.write('rm -rf /Volumes/DATA/repos/scrapper/userdata'+'\n'); terminal.stdin.write('mkdir /Volumes/DATA/repos/scrapper/userdata'+'\n'); terminal.stdin.write('touch "/Volumes/DATA/repos/scrapper/userdata/First Run"'+'\n'); terminal.stdin.write('chmod 777 "/Volumes/DATA/repos/scrapper/userdata/First Run"'+'\n'); terminal.stdin.end(); }, 5000); } 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 @@ -34,3 +34,4 @@ Use [Desktops](http://technet.microsoft.com/en-us/sysinternals/cc817881.aspx) fr #Other options... You could try spawning Chrome as a child process using something like Node.js and piping the output back to the terminal. See chrome.js for an example of how to do this (todo: update to latest Express). -
addyosmani revised this gist
Apr 8, 2013 . 1 changed file with 7 additions and 3 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,4 +1,4 @@ #If you're on Ubuntu or working with a Linux VM... ## Step 1: Install the Ubuntu dependencies needed: @@ -27,6 +27,10 @@ Start and open a page: xvfb-run --server-args='-screen 0, 1024x768x16' google-chrome -start-maximized http://www.example.com > /dev/null & ``` #If you're on Windows.. Use [Desktops](http://technet.microsoft.com/en-us/sysinternals/cc817881.aspx) from the MS SysInternals package. You can spawn your Chrome process directly from the "hidden" desktop and keep it working there (I have not personally tested this). #Other options... You could try spawning Chrome as a child process using something like Node.js and piping the output back to the terminal. -
addyosmani revised this gist
Apr 8, 2013 . 1 changed file with 5 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 @@ -25,4 +25,8 @@ Start and open a page: ``` xvfb-run --server-args='-screen 0, 1024x768x16' google-chrome -start-maximized http://www.example.com > /dev/null & ``` If you're on Windows.. Use [Desktops](http://technet.microsoft.com/en-us/sysinternals/cc817881.aspx) from the MS SysInternals package. You can spawn your Chrome process directly from the "hidden" desktop and keep it working there (I have not personally tested this). -
addyosmani revised this gist
Apr 8, 2013 . 1 changed file with 2 additions and 0 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,3 +1,5 @@ If you're on Ubuntu or working with a Linux VM... ## Step 1: Install the Ubuntu dependencies needed: SSH into your server as a root or do sudo -i. -
addyosmani revised this gist
Apr 8, 2013 . 1 changed file with 2 additions and 2 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,4 +1,4 @@ ## Step 1: Install the Ubuntu dependencies needed: SSH into your server as a root or do sudo -i. @@ -11,7 +11,7 @@ apt-get install -y python-gobject-2 apt-get install -y curl git ``` ## Step 2. Options for starting: Normal: -
addyosmani created this gist
Apr 8, 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,26 @@ 1. Install the Ubuntu dependencies needed: SSH into your server as a root or do sudo -i. Then install necessary software: ``` apt-get update apt-get install -y xvfb fluxbox x11vnc dbus libasound2 libqt4-dbus libqt4-network libqtcore4 libqtgui4 libxss1 libpython2.7 libqt4-xml libaudio2 libmng1 fontconfig liblcms1 lib32stdc++6 lib32asound2 ia32-libs libc6-i386 lib32gcc1 nano apt-get install -y python-gobject-2 apt-get install -y curl git ``` 2. Options for starting: Normal: ``` xvfb-run --server-args='-screen 0, 1024x768x16' google-chrome -start-maximized > /dev/null & ``` Start and open a page: ``` xvfb-run --server-args='-screen 0, 1024x768x16' google-chrome -start-maximized http://www.example.com > /dev/null & ```