dimanche 27 janvier 2013

PDF reduce size of file


Pour réduire la taille d'un pdf, en utilisant ghostscript :

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=OUT.pdf CV.pdf
 
 
Source : http://www.fiat-tux.fr/fr/2010/12/reduire-la-taille-dun-pdf/ 

samedi 29 décembre 2012

Emacs encoding pb w/ macosx

Using : GNU Emacs 22.1.1 I had a utf-8 file, opened by default in iso-latin-1.
C-x  r utf-8 
(via : https://discussions.apple.com/message/6319077#6319077 )

vendredi 30 novembre 2012

LaTeX tip & tricks

I recently discovered the "trim" option of the includegraphics command :
\includegraphics[trim=Wcm Xcm Ycm Zcm]{image-file}
%left bottom right top
Will remove Wcm on the left, Xon the bottom side, Ycm on the right side, and Zcm on the top side. Be careful when trim AND angle are used at the same time !

LaTeX template pour document littéraire

Having to edit a document of a friend studying "art history" and "english language", I created this LaTeX template after some research on the bibliography styles needed for those fields. The bib style needed was : MLA. The default MLA install of LaTeX didn't match what was expected, and I found mla-good.bst. You can download it here : http://www.reed.edu/cis/help/latex/images/mla-good.bst.zip or here : http://pastebin.com/bBg7CUkM (and others styles : http://www.reed.edu/cis/help/latex/bibtexstyles.html).
%% LaTeX Template for littérature student, using article class and mla-good.bst 
%% by : Corentin Mehat (30 Novembre 2012)

%% compile it using :
%%    "rubber -d "
%% or "pdflatex ; bibtex ; pdflatex "

\documentclass[12pt, a4paper]{article}%  font, a4paper : paper size
\usepackage{fullpage} % reduce the default margin

\usepackage[utf8]{inputenc} % encoding : UTF8
\usepackage[T1]{fontenc} % fonts
\usepackage{lmodern} % to avoid the use of bitmap fonts.
\usepackage{amsmath} % math for "XV$^{ème}$ siècle"
\usepackage{amssymb} % math

\usepackage{graphicx} % Deal with external images (cf. template code at the end)

%\usepackage{setspace} % spacing lines
%\doublespacing
%\onehalfspacing
%\setstretch{baselinestretch}



\usepackage[english]{babel} % English hyphenation
%\usepackage[french]{babel} % French hyphenation

\usepackage[round, authoryear, sectionbib]{natbib} % Deal with the references & Bibliography

% To generate the bib file on the first compilation of this file. Run BibLaTeX over it after, and recompile
%code in the next begin/end must be a well formed bibtex file
\begin{filecontents}{outputed-biblio-file.bib}
\end{filecontents}


% For  "TODO" notes : \todo{...} or \todo[inline]{...}
\usepackage[disable]{todonotes} %disable
%\usepackage[french,colorinlistoftodos]{todonotes} %enable


%
\usepackage[a4paper,colorlinks,plainpages=false,pdftex,backref]{hyperref}
 \hypersetup{
     unicode=false,          % non-Latin characters in Acrobat’s bookmarks
     pdftoolbar=true,        % show Acrobat’s toolbar?
     pdfmenubar=true,        % show Acrobat’s menu?
     pdffitwindow=true,      % page fit to window when opened
     colorlinks=true,        % false: boxed links; true: colored links
     linkcolor=blue,         % color of internal links
     citecolor=green,        % color of links to bibliography
     filecolor=magenta,      % color of file links
     urlcolor=cyan,          % color of external links
     linktocpage=true,       % make page number, not text, be link in TOC, LOF and LOT
     breaklinks=true,        % allow links to break over lines
     pdfkeywords={keywork1, keyword2}, % list of keywords
     pdftitle={Document Title (not printed, but in the pdf file)},
     pdfauthor={Author of the document (not printed, but in the pdf file)},
     pdfsubject={Subject of the document (not printed, but in the pdf file)}
 }

\title{Title}
\author{author}
\date{\today} %

% % % % % % %%% BEGIN DOCUMENT
\begin{document}

%\newcommand{\test}{THIS IS A TEST} %macro/command example


\maketitle
%\tableofcontents
\begin{abstract}
You can write your introduction / Abstract / Résumé of the doc here.
\end{abstract}

Write your document here

% Organise your document with : (put the section title into the '{}' )
%\section*{} % will not be numbered
%\section{} % will be numbered
%\subsection*{}
%\subsubsection{}



\begin{figure}
\begin{center}
%\includegraphics*[trim= 0cm 0cm 0cm 0cm, angle=0,scale=0.45]{file-name}
\caption{cartel of the image}
\label{fig:a-unique-name} %in the text : \ref{fig:a-unique-name}
\end{center}
\end{figure}

% % % % BIBLIOGRAPHY
\newpage 

\renewcommand\refname{Bibliography} % Change the bibliography heading title

% Use the "mla-good.bst" style file for bibliography (same directory, or installed where it should)
\bibliographystyle{mla-good} % for MLA bibliography style
\bibliography{outputed-biblio-file} % Use the outputted file for the ref.

\nocite{*} %include all refs from the file (not only the one \citeX{key}

\end{document}

mercredi 28 novembre 2012

Show full path in Finder

In the Terminal.app (default cmd line in macosx) :
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES 
(Source : http://www.tuaw.com/2008/12/05/terminal-tips-enable-path-view-in-finder/ )

jeudi 12 juillet 2012

Mettre un stamp sur une image

Avec convert (de Imagemagick), fonctionne bien avec la version :

$convert --version
Version: ImageMagick 6.5.7-8 2009-11-26 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP


#!/bin/bash
# stamp timbre A_marquer Img_finale

# (c) 2007-2010 by C.M.
# under the GPL License

# prendre deux fichiers d'images
# l'un étant un "sceau" et l'autre une photo
# et marquer la photo du sceau, en bas à droite (ou gauche)
# Image timbre
SCEAU="$1"
# Image à marquer
PIC="$2"
# Fichier de sortie
OUT_IMAGE="$3"
# Proportion du timbre par rapport à l'image
SCALE="/ 20"
# Texte ajouté sous le timbre
TEXTE=""


# dimensions de l'image à marquer
width_pic=`identify -format %w "$PIC"`
height_pic=`identify -format %h "$PIC"`

# dimensions du sceau
width_sceau=`identify -format %w "$SCEAU"`
height_sceau=`identify -format %h "$SCEAU"`

# dimensions auxquelles réduire le sceau
stamp_w=$(( $width_pic $SCALE * 2))
stamp_h=$(( $height_pic $SCALE))



Install NetBSD via clef USB


Voici le challenge :


créer une clef usb bootable en NetBSD, en n'ayant qu'une seule clef dispo et pas de machine netbsd sous la main. Le principal problème est de formater la clef USB dans le bon format (et pas de mkfs dispo pour ce systeme de fichier BSD)


Solution trouvée :


booter netbsd-Live en virtualisé dans Qemu pour transférer vers le disque dur virtuel de Qemu les fichiers à copier sur la clef usb, puis formater la clef usb et y remettre les fichiers de boot.

Nettoyer les metadonnées d'images

j'ai pour cela trouvé jhead :
jhead -purejpg [img.jpg]
jhead is used to display and manipulate data contained in the Exif header of JPEG images from digital cameras. By default, jhead displays the more useful camera settings from the file in a user-friendly for‐ mat. jhead can also be used to manipulate some aspects of the image relating to JPEG and Exif headers, such as changing the internal timestamps, removing the thumbnail, or transferring Exif headers back into edited images after graphical editors deleted the Exif header. jhead can also be used to launch other programs, similar in style to the UNIX find command, but much simpler.

Command(s) of the day

Some colleagues started putting commands on the white-board every X days under
  • comm compare two sorted files line by line
  • paste merge lines of files
  • colordiff diff, with colors
  • colorgcc
  • pgrep look for a process name
  • pkill kill processes by name, not by pid
  • ...

lundi 21 mai 2012

Research Social Networks

Social Networks for people doing research : Mendeley seems to be based on dealing with your PDF collection. Alternative Android application : http://blog.mendeley.com/tipstricks/android-on-mendeley-an-app-guide/ Researchgate http://www.researchgate.net/ Academia.edu http://academia.edu/