One Liner Tips & Tricks
This page is a collection of various tips and tricks that fit into one line (more or less). Theres no specific topic - just a collection of things that needed to be solved at one time or the otherTopics: | Multimedia | System Administration | Tex / LaTeX | R | Vim | MOE |
convert anim.gif frames%02d.gifThen resize the frames while recombining them as
convert frames* -delay 200 -coalesce -resize 500x500 newanim.gifHere the value of delay indicates 2 sec delay between frames. The -coalesce argument is required to so that frames (which are generally of different sizes) are combined properly, rather than mispositioned
- libid3tag
- libmad
- lame
rpm -ivh http://rpm.livna.org/fedora/4/i386/RPMS.lvn/livna-release-4-0.lvn.5.4.noarch.rpm wget http://rpm.livna.org/RPM-LIVNA-GPG-KEY-i386 rpm --import RPM-LIVNA-GPG-KEY-i386Once you've done this you can get the gstreamer MP3 plugin by doing
yum install gstreamer-plugins-mp3For Fedora Core 3, since livna is not a standalone repository it has to be used in conjunction with Fedora Extras a described here
However when I tried to compile MPlayer with the October and September builds of the LiveMedia libraries, I would get an error regarding a protected class in UsageEnvironment.hh. To fix this go to the LiveMedia source direcory and open up UsageEnvironment/include/UsageEnvironment.hh and comment out line 77. Recompile the LiveMedia libraries and then recompile MPlayer and it works fine.
The output file is audiodump.wav which can then be converted to MP3 by doing : lame -m s -q 2 --vbr-new -V 1 -B 320 audiodump.wav song.mp3
(NOTE that the MP3 encoding command line does not include tags)
copy table_name from stdin with delimiter as '\t' null as 'null;and at the end of your data file add
\.The simply do
psql -U username -W -d dbname < datafile.txt
pg_hba.conf
are commented out (or at least exclude the bugs user)
~: (command 3>&1 >stdout.log 2>&3 3>&-) >stderr.log
# svnadmin create --fs-type fsfs /path/to/newrepos # svnadmin dump /path/to/oldrepos | svnadmin load /path/to/newreposSee here for more details
Say your current revision of text.doc is 38 and you want to take a look at revision 37. This is achieved by doing
svn cat -r 37 text.doc > oldversion.docOnce you're done with oldversion.doc you can get rid of it.
An alternative route, which is more applicable if you want to undo previous changes is described here. In short, to go back to revision 37 we would do
svn merge -r 38:37 text.docThus your current copy (i.e., the copy in the current working directory) is now revision 37. However the repository still contains revision 38. So if you decide you really want to keep revision 38 simply do
svn revert text.docand your working copy will be updated to the latest revision in the repository.
For simply viewing older versions of a binary doc, the first approach is much easier.
This is useful if you want to convert documents (say from OpenOffice ) to PDF format without starting the OpenOffice GUI. Simply do
ooffice -pt "PDFWriter" stuff.docHere "PDFWriter" is the name of the PDF printer you have set up via CUPS. In fact the above commandline will take any file format the Ooffice recognizes and dumps PDF formatted versions in the location mentioned above.
$header_page_offset = direct_command( shell_string($gHelper{'echo'}) . ' ' . shell_string('#define __KERNEL__' . "\n" . '#include < asm/page.h > ' . "\n" . $pattern . ' __PAGE_OFFSET') . ' | ' . shell_string($gHelper{'gcc'}) . ' ' . shell_string('-I' . $answer) . ' -E - | ' . shell_string($gHelper{'grep'}) . ' ' . shell_string($pattern)); chomp($header_page_offset); $header_page_offset =~ s/^$pattern \(0x([0-9a-fA-F]{8}).*$/$1/; if ($header_page_offset =~ /[0-9a-fA-F]{8}/) { # We found a valid page offset if (not (lc($header_page_offset) eq lc($gSystem{'page_offset'}))) { if ($source eq 'user') { print wrap('The kernel defined by this directory of header files does ' . 'not have the same address space size as your running ' . 'kernel.' . "\n\n", 0); } return ''; } }and comment the final return statement. Once you have that download the any.any update from here and untar it. Go into the directory and run runme.pl and follow instructions.
- On A, 'ssh-keygen -t rsa' and press enter for everythin
- On A, 'scp ~/.ssh/id_rsa.pub B:/home/username/'
- ssh to B (you'll be asked for your password)
- On B, 'ssh-keygen -t rsa' and press enter for everything
- On B, 'cat id_rsa.pub > > ~/.ssh/authorized_keys2'
- On B, 'scp ~/.ssh/id_rsa.pub A:/home/username'
- Come back to A and do 'cat id_rsa.pub > > ~/.ssh/authorized_keys2'
After having installed stunnel you can create your own SSL certificates (here or here) but I went along with whatever came in the tarball. You'll need to edit /etc/stunnel/stunnel.conf or else copy stunnel.conf.sample that came with the tarball to this location. If you created your own certificates you should uncomment the related lines. My stunnel.conf file looks like this:
cert = /etc/stunnel/stunnel.pem chroot = /var/run/stunnel/ pid = /stunnel.pid setuid = nobody setgid = nobody debug = 7 output = stunnel.log client = yes foreground = no [nntps] accept = localhost:119 connect = news.psu.edu:563This is setup so my NNTP client (pan) can acess my university NNTP server which is SSL enabled. Make sure that /var/run/stunnel exists and is writable by the user and group that stunnel will run under (in this case nobody). Once this is all done, as root do /usr/sbin/stunnel and it should start running. I start it from /etc/rc.d/rc.local so that it starts at bootup.
Finally, start up pan and in the server configuration, rather than specifying the real NNTP server, use localhost as the host and 119 for the port and you should be able to access the news server
find /var/db/pkg/ -mindepth 2 -maxdepth 2 -printf "%P\n" | grep < your package >
- Get a list of hosts that serve ads and make it your /etc/hosts where each hostname is set to 127.0.0.1. You can get such a list here
- Use a stylesheet which blocks various HTML elements responsible for showing ads. You can get one such CSS file here . Its for Galeon but will probably work for Mozilla and Firefox .
- Get the Adblock plugin.
\begin{wrapfigure}{l}{.48\linewidth} \begin{center} \includegraphics[width=\linewidth]{picturefilename} \caption{Some caption} \label{fig:somelabel} \end{center} \end{wrapfigure}
dvips -Ppdf file.dvi -o file.psto generate the PS file, anywhere the string fi occurs in the original TeX file it will be converted into a pound symbol in the final PDF. To get around this append the -G0 flag to the above dvips command line
-dPDFSETTINGS=/prepress -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncodeto the psp2df command line
\usepackage{pifont} \ding{51} %% tick \ding{55} %% cross
http://fuse.pha.jhu.edu/~wolven/posters.html
http://www.phys.ufl.edu/~pjh/posters/poster_howto_UF.html
http://www.astro.gla.ac.uk/users/norman/docs/posters/
http://www.met.ed.ac.uk/~hcp/index.shtml
http://www.robots.ox.ac.uk/~awf/latex-posters/
http://andreas.welcomes-you.com/projects/a0poster/
http://www-aix.gsi.de/~tbaumann/tex_poster.html
http://www.physik.uni-augsburg.de/theo3/Comp/hp750c/computing_hp750c_A0.en.shtml
\usepackage{amsmath} \begin{equation} x_{\substack{a\\b}} \end{equation}Also see The short math guide
\usepackage{amsmath} \makeatletter \def\rightharpoonupfill@{\arrowfill@\relbar\relbar\rightharpoonup} \newcommand{\overrightharpoonup}{% \mathpalette{\overarrow@\rightharpoonupfill@}} \makeatotherand then use \overrightharpoonup{abcd}. Alternatively
\documentclass{article} \usepackage{esvect} \begin{document} $\vv{abcd}$ \end{document}
\renewcommand{\rmdefault}{phv}\renewcommand{\sfdefault}{phv}
Alternatively,
\usepackage{helvet} \renewcommand{\familydefault}{\sfdefault}
\newcommand{\query}[1]{\marginpar{% \vskip-\baselineskip \raggedright\footnotesize \itshape\hrule\smallskip#1\par\smallskip\hrule}}So an example would be
Do some stuff with the code and go for dinner and come back\query{Should we come back?} later and finish it offIf you're using the \emph{setspace} package then you probably want the margin notes to be single spaced, whatever the spacing of the document as a whole. In that case the firt line above would look like
\newcommand{\query}[1]{\marginpar{\singlespacing%
The solution is to use the booktabs package and then use \toprule, \midrule and \botomrule (equivalent to \FL, \ML and \LL from the ctable package). A snippet that shows how to get horizontal rules in a longtable look like those in a ctable
\usepackage{longtable,booktabs} ... \begin{longtable}{lrr} \caption[A Caption]{A Caption}\label{lab} \\ \toprule Head 1 & Head 2 & Head 3 \\ \midrule \endfirsthead \caption[]{(continued)} \\ \toprule Head 1 & Head 2 & Head 3 \\ \midrule \endhead \bottomrule \endfoot %% Put the rows of your table here \end{longtable}
### open output file if ($::opt_gs) { my $pipe = "$GS -q -sDEVICE=pdfwrite $GSOPTS " . "-sOutputFile=$OutputFilename - -c quit"; debug "Ghostscript pipe:", $pipe; open(OUT,"|$pipe") or error "Cannot open Ghostscript for piped input"; }Replace this with
### open output file if ($::opt_gs) { my $pipe = "$GS -q -sDEVICE=pdfwrite $GSOPTS " . "-dAutoRotatePages=/None " . "-sOutputFile=$OutputFilename - -c quit"; debug "Ghostscript pipe:", $pipe; open(OUT,"|$pipe") or error "Cannot open Ghostscript for piped input"; }
plot(1:10,1:10, main=substitute( R^{2} == var, list(var=var)))
library(SSOAP) s <- SOAPServer('http://blue.chem.psu.edu','/tox/services/toxTreeWS', 8080) ret <- .SOAP(s, 'getCramerClass', smiles='CCN', action="urn:xmethods-getCramerClass')The return value of this web services' method is a string which has two parts seperated by a '#'. You can use strsplit to get at the individual components
plot(x,y, xlab='HN Output', ylab=expression(paste('Observed ', log,' (',K[p],')'))
CtoJava.cweb:215: error: static declaration of 'std_env' follows non-static declaration CtoJava.cweb:195: error: previous declaration of 'std_env' was hereThe simple way to fix this is to untar the SJava package resulting in an SJava directory. Then open up SJava/src/RSJava/CtoJava.h and line 14 will read as
extern JNIEnv *std_env; /* initialized in create_Java_vm */Change this to
static JNIEnv *std_env; /* initialized in create_Java_vm */After patching the source I also had to edit the configure file since it was not finding my R shared library. The diff between my version and the original version is
2809c2809 < if test -f ${R_HOME}/lib/libR.so ; then --- > if test -f ${R_HOME}/bin/libR.so ; then 2811c2811 < R_SHARED_LIB="-L${R_HOME}/lib -lR" --- > R_SHARED_LIB="-L${R_HOME}/bin -lR"In addition if you are trying to get SJava running on an AMD64 system you will need to add -fPIC to Makefile_rules.in in the SJava package. (Thanks to Egon Willighagen for pointing this out).
After all the edits are done go to the directory containing the SJava sources and then from the command line do
#: R CMD build SJava #: R CMD INSTALL -c SJava_0.68.tar.gz
After installation I had to make two other changes. In my ~/.bash_profile I added
LD_LIBRARY_PATH=/usr/local/lib/R/library/SJava/libs:\ /usr/local/share/java/jdk1.5.0/jre/lib/i386/client:\ /usr/local/share/java/jdk1.5.0/jre/lib/i386:\ /usr/local/share/java/jdk1.5.0/jre/../lib/i386:$LD_LIBRARY_PATHAlso in /etc/ld.so.conf I added the line
/usr/local/lib/R/lib(I could have put this line in my ~/.bash_profile).
:syn match TAB_CHAR "\t" :hi link TAB_CHAR Error(Thanks to Tom Chase)
vmap ;bf "xc\mathbf{}<esc>"xPNote that this doesn't appear to work if you have the LaTeX-VIM package loaded
db_ExportSD[ 'db.mdb', 'structures.sdf', ['mol'], [] ]This exports all the structures to the file called structures.sdf
entry_keys = db_Entries 'somedb.mdb' db_ExportASCII[ 'somedb.mdb', 'fp.txt', ['FP:MACCS'], entry_keys ]Here somedb.mdb is the name of the MOE database that you want to extract from
In case you want to extract a set of fields from a MOE DB then use the following
entry_keys = db_Entries 'somedb.mdb' fields = dbv_Fields 'somedb.db' mask = m_id igen length fields mask[ [1,2,3] ] = 0 db_ExportASCII[ 'somedb.mdb', 'vars.txt', fields|mask, entry_keys ]Here we specify that the first three fields are not to be exported.