I can only connect to my lab's computers via a router. For simple stuff, this suffices:
homecomp:~ jdoe$ ssh jdoe@router.university.edu
[jdoe@router ~]$ ssh jdoe@labcomp
But this gets annoying for things like copying files. Fortunately, you can set up an SSH tunnel:
homecomp:~ jdoe$ ssh jdoe@router.university.edu -L 4321:labcomp:22
Here you are connecting to the router and also telling it to set up a tunnel from homecomp's local port 4321 to lapcomp port 22 (the default for ssh traffic). You can also add a -N flag (which stops you from running any commands through this terminal) and/or a -f flag (which makes this run in the background). I prefer not to use -f; this way it is easier to kill the tunnel should you need to.
And then you can do things like:
homecomp:~ jdoe$ ssh jdoe@localhost -p 4321
homecomp:~ jdoe$ scp -r -P 4321 jdoe@localhost:~/Documents ~/Desktop/workDocs
homecomp:~ jdoe$ git clone ssh://jdoe@localhost:4321/~/MATLAB
Yay!
Saturday, December 1, 2012
Wednesday, October 3, 2012
How to open source!
I have heard a lot about open source stuff but haven't really been good enough "with computers" to attempt that. Until now! I am attempting to install an open-source video codec called x264 on my Mac.
- Have Xcode installed (got it from Apple; it's a standard installer).
- git comes pre-installed on my Mac.
- Go to a directory where you can put the source code. I just used the desktop; hopefully there won't be any permissions issues.
- Get the repository:
git clone git://git.videolan.org/x264.git - Go to the branch called "stable" (I don't know if this actually changed anything):
git checkout stable - Attempt to compile...Oh no! It needs an assembler:
Found no assembler
Minimum version is yasm-1.0.0
If you really want to compile without asm, configure with --disable-asm.
make: *** [config.mak] Error 1 - Get YASM:
git clone git://github.com/yasm/yasm.git - Compile it:
./configure
make
sudo make install - Oh no! That didn't work...there isn't a configure file! There is a configure.ac file, though, which suggests maybe we need to generate it using autoconf:
autoconf - A error! Something about macros:
configure.ac:14: error: possibly undefined macro: AM_INIT_AUTOMAKE - Apparently there is this thing called aclocal:
aclocal
autoconf - Still errors! According to the Internet, there should already be a configure file here. So I downloaded the tarball instead, and that has it. Okay. Let's try compiling it again:
cd yasm-1.2.0
./configure
make
sudo make install - That seems to have worked!
$ which yasm
/usr/local/bin/yasm - Okay, now we can go back to the x264 folder and try installing it:
cd ../x264
./configure
make
sudo make install - It worked! Yay!
UPDATE: I subsequently needed to perform this installation on another computer, which I only have ssh access to at the moment. It turns out you can also install YASM using MacPorts, which is very easy:
sudo port install yasm
UPDATE 2: Later I needed to do this installation on a computer that didn't have ffmpeg installed, and also I'm not a super user for, so I had to install it to my home directory.
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-shared --prefix=/home/username/myBin
make
make install
and then re-install x264 with appropriate flags to tell it where the ffmpeg library is:
cd x264
export LDFLAGS="-L/home/username/myBin/lib"
export CFLAGS="-I/home/username/myBin/include"
export LD_RUN_PATH="/home/username/myBin/lib"
./configure --enable-shared --prefix=/home/username/myBin
make
make install
Then the call to x264 is:
x264 -q0 --preset placebo -o outputFile.mkv inputFile.avi
UPDATE 2: Later I needed to do this installation on a computer that didn't have ffmpeg installed, and also I'm not a super user for, so I had to install it to my home directory.
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-shared --prefix=/home/username/myBin
make
make install
and then re-install x264 with appropriate flags to tell it where the ffmpeg library is:
cd x264
export LDFLAGS="-L/home/username/myBin/lib"
export CFLAGS="-I/home/username/myBin/include"
export LD_RUN_PATH="/home/username/myBin/lib"
./configure --enable-shared --prefix=/home/username/myBin
make
make install
Then the call to x264 is:
x264 -q0 --preset placebo -o outputFile.mkv inputFile.avi
Friday, September 28, 2012
Macports madness
How to install older versions with MacPorts:
- Go to https://trac.macports.org/browser/trunk/dports and find the revision and directory you want. In my case, it was 91935 and devel/automake
- Go to some temporary directory (one accessible to everybody; see step 5)
- svn co -r 91935 http://svn.macports.org/repository/macports/trunk/dports/devel/automake
- cd automake
- Change read/write permissions and/or ownership so that macports can access Portfile and potentially files. For example, sudo chown -R macports:macports Portfile files
- sudo port install
- You can check the newly-installed version with port installed automake
Wednesday, July 4, 2012
More black-and-white photos
I've taken some more photos (3 rolls of 120 and 1 roll of 35mm) since my last post; here are some that I liked:
The last two were with a 20mm lens on 35mm film and I thought the exaggerated sense of perspective was interesting. The last one was a handheld 1/8 second exposure so I took a couple shots (because processing this film is cheap!) and just hoped for the best. I should've turned on the oscilloscope and captured an interesting waveform, though. Note the computer desktop background!
I don't know if this is a limitation of the film format, my equipment, or my scanning, but the medium-format photos (the first three) show a lot more detail and less grain than the 35mm photos.
The last two were with a 20mm lens on 35mm film and I thought the exaggerated sense of perspective was interesting. The last one was a handheld 1/8 second exposure so I took a couple shots (because processing this film is cheap!) and just hoped for the best. I should've turned on the oscilloscope and captured an interesting waveform, though. Note the computer desktop background!
I don't know if this is a limitation of the film format, my equipment, or my scanning, but the medium-format photos (the first three) show a lot more detail and less grain than the 35mm photos.
Sunday, June 24, 2012
Batch image resize
I came back from Vancouver with more than 1000 photos on my digital camera, each of which is 4-6 MB when saved at the camera's maximum 4928 × 3264 resolution (with "normal" jpeg compression).
This is a bit much, and even after pruning out the bad photos (blurry, etc) there were still quite a few that I wanted to keep but had absolutely no intention of printing at poster sizes or substantially cropping. My largest monitor is 1680 × 1050, an HD TV is 1920 × 1080, and even the absurd new MacBook Pro is "only" 2880 × 1800. So I decided that 3056 × 2024 was large enough for these photos.
Next came the task of actually resizing several hundred photos. I am running OS X 10.6 (Snow Leopard). Initially I tried Gimp, but the batch-processing GUI turned out to be extremely difficult to install, and writing my own command-line scripts was more work than I was really looking for right now.
Finally I got ImageMagick, which I installing using MacPorts (a Linux-like package manager for OS X), and its mogrify program turned out to be exactly what I was looking for. The command is simply:
mogrify -resize 3056x3056 *.jpg
mogrify -resize 3056x3056 *.jpg
And the results look pretty good. This resize dropped the pixel count from 16.1 MP to 6.2 MP and average file size from 5.3 MB to 2.5 MB.
Wednesday, June 13, 2012
Switzer falls
Went hiking Sunday near Switzer falls in the Angeles National Forest. Lots of stream crossings, and this one in particular was guarded by this lizard:
As we got closer, he did some push-ups to warn us off. I crossed first, eventually scaring him off, but he came right back. Here he is standing up to SC:
Not sure what he is. Maybe a Western fence lizard? Apparently the way to tell is to look at their underside.
As we got closer, he did some push-ups to warn us off. I crossed first, eventually scaring him off, but he came right back. Here he is standing up to SC:
Not sure what he is. Maybe a Western fence lizard? Apparently the way to tell is to look at their underside.
Saturday, May 26, 2012
AirFish
A fish-shaped airship!
It's an Air Swimmers shark to which I've added a microcontroller, radio, and inertial sensors.
Tuesday, May 1, 2012
Friday, April 27, 2012
SSH keys
If you would like not to type in your password every time you connect to a remote server (and it really does make a difference), this is what you want:
http://en.wikipedia.org/wiki/Ssh-keygen
and if you want multiple private keys:
http://www.karan.org/blog/index.php/2009/08/25/multiple-ssh-private-keys
http://en.wikipedia.org/wiki/Ssh-keygen
and if you want multiple private keys:
http://www.karan.org/blog/index.php/2009/08/25/multiple-ssh-private-keys
Tuesday, April 24, 2012
Prevent mouse from waking computer from sleep
On Windows 7:
Control panel → Mouse → Hardware tab → Properties → Change Settings → Power Management tab → uncheck "Allow this device to wake the computer"
Convoluted much?
Control panel → Mouse → Hardware tab → Properties → Change Settings → Power Management tab → uncheck "Allow this device to wake the computer"
Convoluted much?
Monday, April 23, 2012
Developing 120 black-and-white film
Revision history
2012/04/23: Initial release.
Notes from development: Increase duration of continuous wash. Consider switching to 1+3 developer dilution with 22 min. development time. Also consider reducing development time. Also, developer ended at 22°C.
2012/05/01: Increased continuous wash duration to 5 minutes. Added note to minimize handling of developer tank.
Notes from development: Started developer temp at 19.5° to allow for heating; ended at 21°C. Some artifacts along top edge of film ("top" relative to coiled cylinder inside the developing tank), see this example.
Labels:
black-and-white,
darkroom,
photography,
procedure
Wednesday, April 4, 2012
Tuesday, April 3, 2012
Southern California adventures
Labels:
Big Sur,
California,
camping,
fishes,
Food,
Monterey,
restaurants,
travel
Tuesday, March 20, 2012
Monday, March 12, 2012
Another flat tire!
Not the first time I've gotten a flat...I wonder if this is a typical rate.
I was driving north on I-5, coming down off the Tejon pass, on the section of road that is all grooved. Going about 65 in the second lane from the left and started to feel some side-to-side wobble. It was intermittent, a little too high frequency for wind gusts, so I figured it was the grooved road. I'm guessing this is where something from the road came up and put a puncture in the sidewall.
After the grooved section ended, the handling returned to normal, but a mile or two later the tire pressure monitoring system (TPMS) went off. I had just added air to the tires in the morning and had forgotten to reset the TPMS, so I figured it was related to that and kept driving, intending to get off the next exit.
About a mile later (and a quarter mile to the off-ramp), the rear passenger-side tire just disintegrated. I've never gotten a flat while driving before, but the experience was oddly familiar...must've been from running over all those spike strips in Vice City.
Fortunately, it was a rear wheel, and aside from a high-frequency wobble from being unbalanced, I didn't suffer loss of controllability. I coasted in gear, and quite fortuitously was able to change lanes and get off the highway all very naturally, with a minimum of steering and no active braking.
I should've taken a picture of the tire, but I was a little too freaked out to think of that. The inside sidewall was completely separated from the tread and in general there was just a lot of damage from driving on it while it was flat.
I changed to the spare, drove 30 miles to Bakersfield, and got a new tire (a Hankook) at Discount Tire. Came out to $150, which is pricey, but they got it on real quick. They pointed out a small puncture (slit-like) and two very large punctures (like someone took a 1/2" hole punch to it) on the outside sidewall. The guys in the shop talked about Continental being a bad brand of tire, so I guess I will look into getting something else when it comes time to replace the rest.
I was driving north on I-5, coming down off the Tejon pass, on the section of road that is all grooved. Going about 65 in the second lane from the left and started to feel some side-to-side wobble. It was intermittent, a little too high frequency for wind gusts, so I figured it was the grooved road. I'm guessing this is where something from the road came up and put a puncture in the sidewall.
After the grooved section ended, the handling returned to normal, but a mile or two later the tire pressure monitoring system (TPMS) went off. I had just added air to the tires in the morning and had forgotten to reset the TPMS, so I figured it was related to that and kept driving, intending to get off the next exit.
About a mile later (and a quarter mile to the off-ramp), the rear passenger-side tire just disintegrated. I've never gotten a flat while driving before, but the experience was oddly familiar...must've been from running over all those spike strips in Vice City.
Fortunately, it was a rear wheel, and aside from a high-frequency wobble from being unbalanced, I didn't suffer loss of controllability. I coasted in gear, and quite fortuitously was able to change lanes and get off the highway all very naturally, with a minimum of steering and no active braking.
I should've taken a picture of the tire, but I was a little too freaked out to think of that. The inside sidewall was completely separated from the tread and in general there was just a lot of damage from driving on it while it was flat.
I changed to the spare, drove 30 miles to Bakersfield, and got a new tire (a Hankook) at Discount Tire. Came out to $150, which is pricey, but they got it on real quick. They pointed out a small puncture (slit-like) and two very large punctures (like someone took a 1/2" hole punch to it) on the outside sidewall. The guys in the shop talked about Continental being a bad brand of tire, so I guess I will look into getting something else when it comes time to replace the rest.
Tuesday, March 6, 2012
Sunday, March 4, 2012
Saturday, March 3, 2012
Monday, February 27, 2012
Fuel economy vs. speed
We all suspect that going faster decreases your fuel economy, and I did an experiment to verify this!
Thursday, February 9, 2012
Where to put new LaTeX packages
The mcode package, for instance, is in:
~/Library/texmf/tex/latex/mcode
Now why doesn't the Mac OS search function find this file?
~/Library/texmf/tex/latex/mcode
Now why doesn't the Mac OS search function find this file?
Wednesday, January 25, 2012
Making MATLAB figures prettier
Changing the default line style (e.g. for printing in black-and-white):
For dotted lines exported to .eps:
http://www.mathworks.com/matlabcentral/fileexchange/15743-fix-dashed-and-dotted-lines-in-eps-export
Usage:
print -depsc myfigure.eps
fix_dottedline('myfigure.eps')
More to come...
set(0,'DefaultAxesLineStyleOrder',{'-','--',':'})
set(0,'DefaultAxesColorOrder',[0 0 0])
For dotted lines exported to .eps:
http://www.mathworks.com/matlabcentral/fileexchange/15743-fix-dashed-and-dotted-lines-in-eps-export
Usage:
print -depsc myfigure.eps
fix_dottedline('myfigure.eps')
More to come...
Tuesday, January 17, 2012
Mathematica for MATLAB users
I plan on expanding this post later; for now it's just a place to put this very useful link:
http://meng6.net/pages/matlab_mathematica_equivalent_commands/
Clear all:
Defining a matrix: A = [1 2 ; 3 4]
A = {{1, 2}, {3, 4}}
This gives you something horrendous:
http://meng6.net/pages/matlab_mathematica_equivalent_commands/
Clear all:
ClearAll["Global`*"]
Defining a matrix: A = [1 2 ; 3 4]
A = {{1, 2}, {3, 4}}
This gives you something horrendous:
Integrate[ 1/(x + 1)^2 , {x , y, 1}
But this gives you the nice expression that you probably wanted:
Simplify[Integrate[ 1/(x + 1)^2 , {x , y, 1} ], {y > 0 , y < 1}]
Wednesday, January 11, 2012
Regex in TextPad
Just spent far too much time trying to figure out regular expressions in TextPad. Here's a good reference:
http://johnbokma.com/textpad/textpad-reference.pdf
The specific things that were holding me up:
http://johnbokma.com/textpad/textpad-reference.pdf
The specific things that were holding me up:
- Go to Preferences->Editor and check "Use POSIX regular expression syntax" so you don't have to escape your parentheses etc.
- Enclose tagged expressions (the things that you'll refer to in your replace string with \1, \2, etc) in parentheses
Latex - more commands
I've been doing 3 problem sets/week in LaTeX for the last several weeks; here are some more tips to follow up on my previous post:
Making your own functions:
\newcommand{\norm}[1]{\left\Vert #1 \right\Vert}
\DeclareMathOperator*{\argmin}{arg\,min}
The * puts the subscript below the operator. To stack subscripts:
\min_{\substack{ X>0 \\ Z \\ W=W^* }}
Different vector formats
Underline, with the line crossing descenders (as in gjpqy):
\usepackage{soul}
\setuldepth{abcdef} % sets ul depth based on letters w/o descenders
\newcommand{\vecu}[1]{\text{\ul{$#1$}}\xspace}
Shortcuts that I've found useful:
\newcommand{\reals}{\ensuremath{\mathbb{R}}\xspace}
\def \ba#1\ea{\begin{align*}#1\end{align*}}
\newcommand{\ii}{^{-1}}
\newcommand{\intii}{\int_{-\infty}^{\infty}}
Matrix formatting
check out these posts from Stefan Kottwitz's excellent TeXblog
A cool trick to turn + - = into alignment marks (e.g. for systems of linear equations)
http://tex.stackexchange.com/questions/6965/multicol-layout-for-systems-of-linear-equations
Cool stuff with figures
http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions
MATLAB code
Get the mcode package, which configures the listings package use with MATLAB. The demo is pretty self-explanatory, and the package works great!
Miscellaneous:
Accent marks:
http://en.wikibooks.org/wiki/LaTeX/Accents
Found this while researching this post and learned a bunch of new things:
http://www.math.uiuc.edu/~hildebr/tex/basics.html
For example, use \eqref to put parentheses around the equation number.
To reduce vertical spacing around section headings: \usepackage[compact]{titlesec}
Cursive lowercase l, as in l2: \ell
Making your own functions:
\newcommand{\norm}[1]{\left\Vert #1 \right\Vert}
\DeclareMathOperator*{\argmin}{arg\,min}
The * puts the subscript below the operator. To stack subscripts:
\min_{\substack{ X>0 \\ Z \\ W=W^* }}
Different vector formats
Underline, with the line crossing descenders (as in gjpqy):
\usepackage{soul}
\setuldepth{abcdef} % sets ul depth based on letters w/o descenders
\newcommand{\vecu}[1]{\text{\ul{$#1$}}\xspace}
Bold:
\newcommand{\vecb}[1]{\ensuremath{\boldsymbol{#1}}\xspace}
And one more layer of shortcut/indirection (overwrites the caron diacritic)
\renewcommand{\v}[1]{\vect{#1}}
Shortcuts that I've found useful:
\newcommand{\reals}{\ensuremath{\mathbb{R}}\xspace}
\def \ba#1\ea{\begin{align*}#1\end{align*}}
\newcommand{\ii}{^{-1}}
\newcommand{\intii}{\int_{-\infty}^{\infty}}
Matrix formatting
check out these posts from Stefan Kottwitz's excellent TeXblog
A cool trick to turn + - = into alignment marks (e.g. for systems of linear equations)
http://tex.stackexchange.com/questions/6965/multicol-layout-for-systems-of-linear-equations
Cool stuff with figures
http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions
MATLAB code
Get the mcode package, which configures the listings package use with MATLAB. The demo is pretty self-explanatory, and the package works great!
Miscellaneous:
Accent marks:
http://en.wikibooks.org/wiki/LaTeX/Accents
Found this while researching this post and learned a bunch of new things:
http://www.math.uiuc.edu/~hildebr/tex/basics.html
For example, use \eqref to put parentheses around the equation number.
To reduce vertical spacing around section headings: \usepackage[compact]{titlesec}
Cursive lowercase l, as in l2: \ell
Subscribe to:
Posts (Atom)