Tuesday, March 20, 2012

vim editing a remote file

Using scp:

vim scp://keith@linux.cs.wmu.edu//home/keith/my.file

You may have to re-enter your password each time you save the file. From http://tipotheday.com/2008/06/08/editing-remote-files-with-vim-and-scp

Thursday, February 2, 2012

Aggregate functions in LaTeX

\usepackage{amsmath} % for underset

\newcommand{\aggregate}[2]{\underset{#2}{\operatornamewithlimits{#1\ }}}


\begin{equation}
x^{*}=\aggregate{argmax}{x\in\mathbf{\mathcal{X}}} f(x)-g(x)
\label{foo.eq}
\end{equation}



Looks like:

Friday, January 13, 2012

Setting up ssh/http port mapping on a Mac using Airport (Extreme)

  1. Find your computer's MAC address
    • Airport utility
    • Advanced section
    • Logging & statistics tab
    • Click on "Logs & statistics" button
    • DHCP clients section
  2. Ensure that DHCP IP address stays the same.
    • Airport utility
    • Internet section
    • DHCP
    • Add a DHCP reservation
      • Description: e.g., Norple@10.0.1.2
      • Reserve by MAC (not client—it's not working for me)
      • I used 10.0.1.2, a fine IP address indeed
  3. Set up port services
    • Airport utility
    • Advanced
    • Port Mapping
    • Add:
      1. SSH (choose nonstandard public port, like 2319, private can be 22)
      2. Person web sharing
      3. Others...?
  4. Update Airport so that it shuts down and restarts
  5. Set up web and file sharing on your computer
    • System preferences
    • Sharing
    • Check remote login, web sharing, whatever you want.

Thursday, December 15, 2011

Combining Multiple PDF files into one

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf source1.pdf source2.pdf source3.pdf


Source:http://hints.macworld.com/article.php?story=2003083122212228.

Friday, September 30, 2011

Back-up DVDs from a MacOS command line

How to backup DVDs (this approach will not overcome copy protection--because of the ripping process).

Prereq:

Install dvdbackup from http://dvdbackup.sourceforge.net. Note that this requires libraries (i) libdvdread and (possibly, ii) libdvdcss. Download and install the libraries, then dvdbackup (all are ./configure,make,sudo make install). Additional note: I installed libdvdread via mac ports, but dvdbackup failed to configure because it required a different version. I then downloaded and installed version 0.9.7 separately, then ./configure worked (I also downloaded and installed libdvdcss--not sure if that matters.)

To backup a DVD:

  1.  dvdbackup -v -i /dev/disk1 -n NAME -M 
    where /dev/disk1 should be replaced with the device currently associated with the inserted disc, and NAME is whatever name you want to assign to the project. It turns out, the -n option is necessary. Without more options, dvdbackup creates a similarly-named directory and writes the files there (the -v option is just for verbosity--use dvdbackup --help)
  2.  hdiutil makehybrid -udf -o NAME.iso path-to-FOLDER 
    where NAME is again up to you, but path-to-FOLDER must contain the VIDEO_TS directory created by dvdbackup (it must not be the VIDEO_TS directory itself). Typically, this will be the directory created by dvdbackup.
  3. Burn the image with
     hdiutil burn NAME.iso 
    This, apparently, finds your DVD device, writes and ejects it.
Good luck.

Thursday, August 4, 2011

auto-indent an entire source code file in VI (vim, gvim)

gg=G


=, the indent command can take motions. So, gg to get the start of the file, = to indent, G to the end of the file, gg=G.

http://stackoverflow.com/questions/506075/how-do-i-fix-the-indentation-of-an-entire-file-in-vi

Followers