Produce handouts of slidify or Rpres HTML5 presentations - html

I would like to give my audience handouts of my HTML5 presentation created by slidify or Rstudio's R presentations. Any suggestions?

1) Install the software pandoc:
http://johnmacfarlane.net/pandoc/installing.html
2) Install the stoftware MikTex (Windows):
http://miktex.org/download
3) Install the R package knitr
install.packages("knitr")
4) The following only worked after I restarted my PC (Windows)
# Load packages
library("knitr")
# Check if pandoc is found on your system
system("pandoc -v")
# Set working directory, e.g.:
# setwd("C:/r_files")
# Convert mark-up file
pandoc('p4.Rpres', format='latex') # PDF
pandoc('p4.Rpres', format='docx') # DOCX
During the execution of the latter command multiple pop-ups were shown saying that MikTex needs to install specfic add-ons to process the command. You have to confirm this to proceed.
For more details see: http://yihui.name/knitr/demo/pandoc/

why don't you use (Awesome Screenshot) is a browser plugin (fire fox, chrome) which takes an images of the browser and creates a .jpg or.png file of the image, also if you really want to make it into a .pdf import the image into photoshop and safe it as a.pdf
hope I answer your question?

Related

Open up multiple PWA using the google-chrome cli option

I wanted to open multiple PWA's (Progressive Web Apps) like Twitter, Google-Keep, and Youtube Music at the StartUp of Ubuntu.
There are particular app-id for each of the above sites, which are located as a folder at ~/.config/google-chrome/Default/Extensions/
Twitter - jgeocpdicgmkeemopbanhokmhcgcflmi
Google Keep - hmjkmjkepdijhoojdojkdfohbdgmmhki
YouTube Music - cinhimbnkkaeohfgghhklpknlkffjgod
So currently, to open these three PWA's at startup, I need to use three different CLI commands like the below at Ubuntu's Startup Application Preferences
/usr/bin/google-chrome --profile-directory=Default --app-id=jgeocpdicgmkeemopbanhokmhcgcflmi
/usr/bin/google-chrome --profile-directory=Default --app-id=hmjkmjkepdijhoojdojkdfohbdgmmhki
/usr/bin/google-chrome --profile-directory=Default --app-id=cinhimbnkkaeohfgghhklpknlkffjgod
How do I combine the above three commands to present an array of app-ids? I couldn't find anything in the man pages as well.
Is there any documentation related to the above?
Asked a similar question #here
Posted on your similar question...
The following code is modified from code based on this site's example.
For your shell script
for appid in "$#"
do
/usr/bin/google-chrome --profile-directory=Default --app-id=$appid &;
done
The command to call it
sh my-script.sh jgeocpdicgmkeemopbanhokmhcgcflmi hmjkmjkepdijhoojdojkdfohbdgmmhki
Further Ideas
Have a configuration file that houses the IDs you want to open, and use the shell script to loop through the IDs in the config as opposed to the command line arguments.

How to install colortheme in NeoVim in Mac OS X?

I just installed NeoVim VimR 0.13.1 from https://github.com/qvacua/vimr/releases
for Mac OSX. I was able to set default options by creating a file at
~/.config/nvim/init.vim
Now I am having a hard time trying use a color theme. For example I am interested with OceanicNext theme from https://github.com/mhartington/oceanic-next
So I downloaded the zip file, unzipped it then it creates a folder called
oceanic-next-master
So I moved this folder to
~/.config/nvim/oceanic-next-master
Added necessary code to the init.vim file
" For Neovim 0.1.3 and 0.1.4
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
" Or if you have Neovim >= 0.1.5
if (has("termguicolors"))
set termguicolors
endif
" Theme
syntax enable
colorscheme OceanicNext
But even restarting the VimR, nothing happens. So I tried renaming the folder name from
~/.config/nvim/oceanic-next-master
to
~/.config/nvim/OceanicNext
Still no luck. So tried to copy the actual OceanicNext.vim file to
~/.config/nvim/OceanicNext.vim
Still didn't work restarting it. So I tried running the command directly
colorscheme OceanicNext
But it give me the following error message
Cannot find color scheme 'OceanicNext'
I also tried install other color scheme from https://github.com/frankier/neovim-colors-solarized-truecolor-only but still wasn't able to make it work.
I also have MacVim installed and just copy and pasting the plugins into the ~/.vim worked, but looks like NeoVim is different? What am I doing wrong?
Thank you.
The nvim documentation on the colorscheme command :help colorscheme
:colo[rscheme] {name}
Load color scheme {name}. This searches 'runtimepath' for the file
"colors/{name}.vim". The first one that is found is loaded. Also
searches all plugins in 'packpath', first below "start" and then under
"opt".
You can put the color scheme file into ~/.config/nvim/colors f older. Where ~ is your user home directory.
Consider you have "nord.vim" colorscheme. The full path to it will be ~/.config/nvim/colors/nord.vim.
Then the :colorscheme nord command will be able to load the theme.
By the way, vim-plug plugin is great for managing vim and neovim plugins and colorschemes. It will install/update/delete plugins including colorschemes for you. Give it a try.
Had to install vim-plug manager from https://github.com/junegunn/vim-plug
by placing the plug.vim file to
~/.config/nvim/autoload
to install the plugins.

How to parse HTML into .txt format using C

I need to parse HTML into .txt format using C.
An example - it has to detect each
1. <p>
2. <tr>
3. <ul> etc...
and convert them into text (in a document)
Can somebody help please?
I think, the easiest way to download a html webpage in c is to use libcurl. Assuming you have already set up your development environment, follow these steps:
Visit the download page of libcurl and download its latest version.
take a look at the install page and learn how to install the library. For Linux, the installation is pretty straight forward, just type ./configure && make && make install in the terminal.
Download the url2file.c example of libcurl. The <curl/curl.h> header file which is exposed in this file essentially provides necessary functions to let you communicate with the web server.
Next, compile the url2file.c using gcc -o url2file url2file.c -lcurl.
Finally, test url2file using ./url2file http://example.com. The results will be stored in page.out file which is in plaintext.
NOTES:
You need to install the libcurl in order to be able to compile the url2file.c file, unless it will throw a fatal error.
If you have already installed the curl program on your machine, you can download webpages using curl http://example.com > page.out command in the terminal.
Also, wget lets you to download and store webpages: wget http://example.com.
This answer stores a webpage as a pliantext. It doesn't perform any specific html tag processing.

Open URL in Chrome & save its source code using Command prompt

I am having a hard time to find how to save the page as html or .txt using command line in Chrome Browser,
This is what I've done so far,
C:\Users\Cipher\AppData\Local\Google\Chrome\Application>chrome.exe --new-window
http://google.com
This command will open a new window of Chrome browser and visit google.com but i couldn't be able to figure our how can i save google.com as html or as txt file ,
is there anyway to do so using command prompt ?
You cannot perform the task you describe manually, but you can perform it using WebDriver automation.
Chrome can be remote controlled using an API called WebDriver (part of Selenium 2 automating suite). WebDrive has bindings for various programming languages, including e.g. JavaScript and Python.
Here is example code for Python (not tested):
from selenium import webdriver
driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
driver.get('http://www.google.com/');
html = driver.page_source
f = open("myhtml", "wt")
f.write(html)
f.close()
Orignal example
Do you really need to open Google Chrome? You can get the page source using Wget (available for UNIX systems or for Windows in this post on SuperUser). Once installed, just use the following command:
wget http://google.com -O yourfilename.html
And this should be all :) I don't think there's a way to tell Chrome to download the HTML from the command line though :(
UPDATE: There's a repo on GitHub called chrome-cli that allows the user to control Chrome from the command line. Downside is that it only works on Mac OS X.
I created a small script to do perform exactly this task: https://github.com/abiyani/automate-save-page-as . See the demo gif in the README.
It automates the keyboard actions you would otherwise perform to save the page manually (literally sends those key signals to OS). As a side effect of it being used in another project of mine, it's been tested on various linux flavors: Ubuntu, Mint, Fedora, etc - and works fine on all of them. It probably won't work (at least without modifications) on Mac, and certainly not on Windows.
This should work :
cd c:\Program Files (x86)\Google\Chrome\Application
c:\Program Files (x86)\Google\Chrome\Application>chrome.exe --headless --dump-dom --enable-logging --disable-gpu https://www.google.com >c:\yourpath\yourfile.html

How to use GVIM to edit a remote file?

I use GVIM on Ubuntu 9.10. I'm looking for the right way to configure GVIM to be able to edit remote files (HTML, PHP, CSS) by for exemple ftp.
When i use :e scp://username#remotehost/./path/to/file i get: error detected while processing BufEnter Auto commands for "*":E472: Command failed.
When i open a file on remote via Dolphin or Nautilus, i cannot use other files with NERDTree.
Finally when i edit on remote a file via Dolphin the rights are changing to access interdit.
So how to use GVIM to edit remote files like on my localhost?
I've found running the filesystem over ssh (by means of sshfs) a better option than having the editor handle that stuff or running the editor itself over an ssh tunnel.
So you need to
apt-get install sshfs
and then
sshfs remoteuser#remotehost:/remote/path /local/mountpoint
And that will let you edit your remote files as if they were on your local file system.
To make it even smoother you can add a line to /etc/fstab
sshfs#remoteusername#remotehost:/remote/path /local/mountpoint fuse user,noauto
For some reason I find that I have to use fusermount -u /local/mountpoint rather then just umount /local/mountpoint when experimenting with this. Maybe that's just my distro.
Recently I've also noted that the mounting user must be in the fuse group. So:
sudo addgroup <username> fuse
An other popular option of course, would be to run vim (rather then gvim) inside a GNU Screen session on one machine and connect to that session via ssh from wherever you happen to be. Code along all day at work and in the evening you ssh into your office computer, reattach to your gnu screen session and pick up exactly where you left off. I used find the richer color palette to be the only thing I really missed from gvim when using vim, but that can actually be fixed thanks to a fork of urxvt that will let you customize the entire 256 position color palette, not just the 16 first positions of the palette that most terminal emulators will let you customize.
There is one way and that is using the remote host's copy, using SSH to forward the X11 client to you, like so:
user#local:~/$ ssh -X user#host
...
user#host:~/$ gvim file
The latter command should open gvim on your desktop. Of course, this relies on the remote host having X11 / gnome / gvim installed in the first place, which might not be the solution you're looking for / an option in your case.
Note: X11 forwarding can be a security risk.
In order for netrw to work seamlessly, I believe you need to not be in compatibility mode.
Try
:set nocompatible
then
:edit scp://host/path/to/file
Try this
:e scp://username#remotehost//path/to/file
Note that the use of // is intentional after remotehost it gives the absolute path of your file
:)
http://www.celsius1414.com/2009/08/19/how-to-edit-remote-files-with-local-vim/
The vim tips wiki has an article on this, Editing remote files via scp in vim.
EDIT: Key authentication is not necessary for opening files over ssh. Vim will prompt for password.
It would be useful to note if netrw.vim was loaded by vim when it started.
:echo exists("g:loaded_netrwPlugin")
For opening files over ssh, you need your local machine's public key in the server's authorized keys. Following help section in vim documentation explains it pretty well.
:help netrw-ssh-hack
Quick way to export public key would be by using ssh-copy-id (if available).
ssh-copy-id user#host
And have a look at netrw documentation for network file editing over other protocols.
:help netrw
HTH.
According to the docs BufEnter is processed after the file has been read and the buffer created, so my guess is that netrw successfully read the file but you have a plugin that assumes the file is on the local filesystem and is trying to access it, e.g. to run ctags.
Try disabling all your plugin scripts except the default Vim ones, and then editing the file.
Also, try editing a directory to see if netrw can read that - you need to put the / on the end so that netrw knows it is a dir.
About your command, :e scp://username#remotehost/./path/to/file : note that with netrw, scp is taken relative to your home directory on that remote host. To avoid home-relative pathing, drop that "."; ie. :e scp://username#remotehost//path/to/file .
to accomplish this on windows download/install the Dokan library and Dokan SSHFS, which are the first and last links on this page.
I didn't think you were going to be able to directly edit a remote file using GVIM running locally. However, as others have pointed out, this is defintiely possible. This looks very interesting; I will check this out. I will leave the rest of my post up here, in case it is useful to anyone else, as an alternative method. This method will work even if you don't have SSH access to the file (ie, you only have FTP, or S3, or whatever).
You may get that effect, though, by tying GVIM into a graphical file transfer application. For example, on OS X, I use CyberDuck to transfer files (FTP, SFTP, etc). Then, I have it configured to use GVIM as my editor, so I can just double-click on a file in the remote listing, and CyberDuck will download a copy of that remote file, and open it in GVIM. When I save it in GVIM, CyberDuck uploads the file back to the remote host.
I'm sure that this functionality is not unique to CyberDuck, and is probably present in most nicer file transfer utilities.