- (256)How to set margins
\usepackage{vmargin}
\setmarginsrb{ leftmargin }{ topmargin }{ rightmargin }{ bottommargin }{ headheight }{ headsep }{ footheight }{ footskip }
- (263)Drawing grids in TikZ
millimetric grid:
\draw[step=.1cm,lightgray,very thin] (0,0) grid (10,10);
\draw[step=1cm,black,very thin] (0,0) grid (10,10);
useful grid to place objects
\draw[step=.5cm,lightgray,very thin] (0,0) grid (10,10);
\draw[step=1cm,gray,thin] (0,0) grid (10,10);
- (264)To place a node above another (e.g. for intermediate nodes for angular arrows) in TikZ
\path (MF4.north) -- ++(0,.5) node (midconso3b) {}; % to see it, use {$\times$}
- (265)To enable use of \mbox or \scalebox (\LaTeX) with \matrix (\TikZ)
[ampersand replacement=\&] + use \& as separator in matrix
- (266)The Syntax of Partway Modifiers in TikZ
(1,2)!.75!(3,4)
The meaning of this is: "Use the coordinate that is three quarters on the way from (1,2) to (3,4)."
The second coordinate may be prefixed by an angle, separated with a colon, as in (1,1)!.5!60:(2,2).
The general meaning of a !factor!angle:b is "First, consider the line from a to b. Then rotate this line by angle around the point a. Then the two endpoints of this line will be a and some point c. Use this point c for the subsequent computation, namely the partway computation."
- (44)How to label things and reference them?
\label{labelname} to label
\ref{labelname} to reference
For tables and figures make sure the \label{} comes inside \caption{}
- (45)How to get the euro symbol in LaTeX
\documentclass[10pt]{article}
\usepackage{eurosym}
\begin{document}
You owe me \euro{10.00}.
- (46)Good presentations with math in PDFs!
ps2pdf:
latex presentation.tex
bibtex presentation
latex presentation.tex
latex presentation.tex
dvips -Ppdf -G0 presentation.dvi -o presentation.ps
ps2pdf -sPAPERSIZE=a4 presentation.ps presentation.pdf
acroread presentation.pdf
so "-Ppdf -G0" is the graal to use math in PDF
- (111)Prettier font for PDF
It is better to use OT1 fonts than T1:
\usepackage[latin1]{inputenc}
\usepackage[OT1]{fontenc}
is better than:
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
- (114)Manage font/indent/spaces inside the bibliography (does not work with PowerDot)
\newcommand{\bibfont}{\tiny} % Bibliography's font size
\setlength{\bibhang}{4ex} % Indent of Bibliography entries
\setlength{\bibsep}{3pt} % Separation between BiB entries
- (152)How to get pretty Cross and Check marks
\usepackage{pifont}
Check (valid, comme une racine carree) symbol : \ding{52}
Cross (invalid, comme une croix) symbol : \ding{56}
\usepackage{bbding}
Check = \Checkmark
Cross = \XSolidBrush
- (157)Some versions of PDFtricks do not generate the temporary eps->pdf picture files correctly
use the patch below:
< \immediate\write18{dvips -o \PDFTfigname.ps \PDFTfigname}
< \PDFTWarning{pdftricks}{PS generated -- \PDFTfigname.ps}}{}
< \IfFileExists{\PDFTfigname.ps}{%
< \immediate\write18{pstopdf \PDFTfigname.ps}
< \PDFTWarning{pdftricks3}{\PDFTfigname.ps converted to \PDFTfigname.pdf}}{}
< \IfFileExists{\PDFTfigname.pdf}{%
< \immediate\write18{pdfcrop \PDFTfigname.pdf}
< \immediate\write18{mv \PDFTfigname-crop.pdf \PDFTfigname.pdf}
< \PDFTWarning{pdftricks3}{\PDFTfigname.pdf cropped}}{}
---
> \immediate\write18{dvips -E -o \PDFTfigname.eps \PDFTfigname}
> \PDFTWarning{pdftricks}{EPS generated -- \PDFTfigname.eps}}{}
> \IfFileExists{\PDFTfigname.eps}{%
> \immediate\write18{epstopdf \PDFTfigname.eps}
> \PDFTWarning{pdftricks3}{\PDFTfigname.eps converted to \PDFTfigname.pdf}}{}
- (158)List of Bugs in PDFTricks
BUG1: PDFTricks requires you enable shell-escape (but you can use latex's runtime option --shell-escape).
BUG2: \begin{pdfpic} MUST be at the very beginning of the line (first char)!
BUG3: PDFTricks generates the temporary files using the "article" class, which creates problems (e.g.: justification of text to too small margins), if you're using larger classes, like a0poster.
BUG4: within \begin{psinputs}\end{psinputs}, only \usepackage are taken into account. So it is impossible to add, for instance, \input{} and have common definitions of macros for every picture.
- (160)PowerDot does not like the \onslide in titles of the slides
If I put an \onslide command in the title of the slide, then each slide will appear X times (where X is the number of overlays I'm creating in the slide with the \onslide in the title). This is because the \onslide command will appear also in the "TOC menu" on the left of each slide
The solution is to set the bm= and toc= in the options of the slides, to override the not-working-TOC
- (203)Absolute Positioning of Graphics (particularly in Beamer)
textpos was what you are looking for.
you can use the following macro:
%the needed packages
\usepackage[absolute,showboxes]{textpos}
\usepackage{graphicx}
%adjust the TPHorizModule and TPHorizModule units to the displayed mm %grid
\TPGrid{210}{297}
%puts a graphic at the absolute position described by the grid
%#1 x, #2 y, #3 width, #4 height, #5 x-ref-ratio, #6 y-ref-ratio, #7 graphic
\newcommand\putpic[7]{%
\begin{textblock}{#3}[#5,#6](#1,#2)%
\includegraphics[width=#3\TPHorizModule,height=#4\TPVertModule]{#7}%
\end{textblock}%
}
\putpic{20}{20}{100}{100}{graphics/mypic}
(from: http://old.nabble.com/Absolute-Positioning-Graphics...-Grid--td19273385.html)
Eventually \begin{textblock*} allows to enter abolute coordinates rather than TPGrid-related ones.
- (208)How to use normal text in math mode
Use the $\text{}$ command, which is included in the \usepackage{amsmath}
e.g., ...the i$^\text{th}$ value is...
- (212)On the use of counters
\newcounter{plip} % defines the counter
\setcounter{plip}{3} % sets the value
\addtocounter{plip}{-1} % modifies the value
plipVal=\number\value{plip} % prints the value as a number
plipStr=\arabic{plip} % prints the value as a string in arabic format
- (213)On the use of counters and lengths
Counters store only int values.
Lengths store double values, but with a unit.
To store a double without unit, use pgf package (see hint 500) (for instance to use in \makebox(__,__){}).
- (241)Solving the infinite loop problem of kpsewhich (\subset Kpathsea) (and csqtly the freezing of texlive pkg installation in OpenBSD)
[stupidities]
- fsck
- rm -fR ~/.texlive*
- work with a different terminal program
[compile test .tex files]
- pdftex -recorder story # [then see see .fls files?]
pdflatex -recorder sample2e
[problems finding the .pool files or texmf.cnf?]
- pdftex -ini \\dump
pdftex \\end
[search path problem?]
- kpsewhich -prog pdflatex -debug 6 pdftex.map
- pdflatex -kp 6 nfssfont
- texconfig conf
- kpsewhich uses $PATH? => simplify it
[font problem? & texmf trees]
- tlmgr generate updmap
- sudo mktexlsr
sudo -H updmap-sys --nohash --nomkmap --syncwithtrees
sudo -H updmap-sys --nohash --nomkmap --enable Map mymap1.map
sudo -H updmap-sys --nohash --nomkmap --enable Map mymap2.map
...
sudo -H updmap-sys
- mktexfmt --all
- (mktextfm <fontname>)
----------------
So path searching is not slow and CPU usage is slow, which
indicates waiting for I/O. This could be loading files
(.pool file, format, ...), console output, or file output.
You didn't mention of whether files are on local disk or
network, USB, etc.
1. on general principles, I'd do a disk cleanup and run
chkdsk /f to make sure disks are OK.
2. check for signs of trouble in the event viewer.
3. run "pdftex -recorder story" and and "pdflatex -recorder
sample2e" to check for files in unexpected locations,
especially network or USB drives.
4. try a different terminal program -- there have been
reports of widely varying performance between different
terminals, remote ssh, etc.
----------------
Can come from kpsewhich (in KPathSea pkg)
----------------
> maybe compare the output of
>
> kpsewhich -prog pdflatex -debug 6 pdftex.map
>
> and
>
> pdflatex -kp 6 nfssfont
And study the output of
texconfig conf
-----------------
BTW, before you begin to study large .fls files, you can test more
simple things. For instance
pdftex -ini \\dump
doesn't load a format file. If this is slow, maybe pdftex has
problems finding the pool file or texmf.cnf.
Then you could try
pdftex \\end
which doesn't make much more than to load a format file.
What also comes to my mind: Check your environment variables! No
TeX-related environment variable is required. This is a nasty thing
on Cygwin because Cygwin inherits the Windows environment.
This means that you'll definitely run into trouble if you have another
TeX distribution on Windows which makes use of environment variables.
I doubt that this is the problem because you said that you just
replaced the binary. But it makes sense to check this anyway.
Curious things can happen. My first attempt to compile TeXLive failed
because Cygwin appends UNIX directories to the Windows path. I had to
set PATH=/usr/local/bin:/usr/bin:/bin explicitly on Cygwin in order to
get it compiled.
--------------------
t'as essayé de supprimer les trucs dans ton home?
<Jaj-J> guigui: ton .texlive?
<guigui> Jaj-J: yop, sans succes ;{
<guigui> Jaj-J: en tous les cas tout se rapporte à un kpsewhich mal configuré ...
<Jaj-J> guigui: et c'est quoi ça?
<guigui> Jaj-J: un truc pour indexer les fichiers texmf apparemment
<guigui> Jaj-J: genre kpsewhich color.sty
<guigui> Jaj-J: devrait retourner /usr/local/share/texmf-dist/tex/latex/graphics/color.sty en 2 sec
<Jaj-J> guigui: ah ok
<Jaj-J> guigui: et toi il retourne quoi?
<guigui> Jaj-J: moi il rame 2 minutes @home et part en bcl @work
<Jaj-J> guigui: ah ouais :)
<guigui> Jaj-J: apparemment je commence à approcher de la solution avec la commande : kpsewhich -debug 6 color.sty
<guigui> Jaj-J: il semble que les ls-R soit en cause et il y a une cmd pour les refaire
<guigui> Jaj-J: je crois que c mktexlsr
----------------------
For that I would like to use the
'tlmgr generate updmap'
procedure with a local file
'updmap-local.cfg' in my 'library/texmf/web2c/' folder.
-----------------------
pdflatex -kp 6 nfssfont # attend un <nom de font> puis lance mktextfm <nom de font>
-----------------------
A personal version of the pdftex.map, etc., files are created in
~/.texlive2009/ not in your personal tree at ~/Library/texmf/. Take a
look there.
Also, for personal maps you need to invoke
updmap --enable Map mymap.map
for each of the map files you want to activate. NOTE: there is no sudo
used for personal map since that would create the files with root as
owner in your personal texlive2009 tree.
I usually discourage doing things this way. I'd install the fonts in
the proper subdirectories of /usr/local/texlive/texmf-local/, run
sudo mktexlsr
and then
sudo -H updmap-sys --enable Map mymap.map
-----------------------
#!/bin/bash
sudo mktexlsr
sudo -H updmap-sys --nohash --nomkmap --syncwithtrees
sudo -H updmap-sys --nohash --nomkmap --enable Map mymap1.map
sudo -H updmap-sys --nohash --nomkmap --enable Map mymap2.map
...
sudo -H updmap-sys
on the system wide method. This will first get all the maps entered in
updmap.cfg, enable each of the maps you want without taking the time
to rebuild the pdftex.map, etc., and finally rebuild the the system
wide pdftex.cfg, etc., maps.
If you are trying for a purely personal configuration use
updmap ...
instead of
sudo -H updmap-sys ...
above.
If you want to build a global map that includes the fonts in your
personal texmf tree use
sudo updmap-sys ...
instead of
sudo -H updmap-sys
since the distribution files are owned by root when installed with
MacTeX.
--------------------------
Am 05.11.2009 um 23:02 schrieb Herbert Schulz:
> sudo mktexlsr
This command creates up-to-date ls-R "hash" files of the system -
not needed privately
> sudo -H updmap-sys --nohash --nomkmap --syncwithtrees
This command just updates the system-wide updmap.cfg file - not
needed privately
> sudo -H updmap-sys --nohash --nomkmap --enable Map mymap1.map
> sudo -H updmap-sys --nohash --nomkmap --enable Map mymap2.map
> ...
The commands above just record changes in the system-wide updmap.cfg
file. No MAP file is rebuilt, so the commands run quite fast. Last
step in this scheme is the following command which actually rebuilds
the system's MAP files:
> sudo -H updmap-sys
Using just 'updmap' instead of 'sudo -H updmap-sys' or 'sudo updmap-
sys' will work on the private fonts and MAP files set. This private
setup will contain all MAP file fragments enabled by the system,
except they are extra disabled privately.
Mostly from: http://www.tug.org/pipermail/pdftex/2007-September/007360.html
[!!!! Solution !!!!]
For some time now, I had in my .bashrc:
# NOTE: the // indicates to LaTeX to get recursively into the subdirs.
for i in . ~/.TeX/installedPkgs/* ~/.TeX/installedPkgs2//*
do
export TEXINPUTS=${i}//:$TEXINPUTS
export BIBINPUTS=${i}//:$BIBINPUTS
export BSTINPUTS=${i}//:$BSTINPUTS
done
Unfortunately, in my new machine, these directories point to nothing that exists. It seems that either the 'inexistant dirs' or the use of '//*' in the pathes makes kpsewhich loop infitely. The solution consists simply in unsetting the vars TEXINPUTS BIBINPUTS and BSTINPUTS.
- (251)How to use TikZ for drawing pics?
- Come back to normal font in italic mode: [font=\normalfont]
- Basic syntax for node: \node[opts] (name) at (position) {text};
- To make lighter/stronger colors: [fill=red!20]
- Place nodes relatively: [above/below/left/right,node distance=5mm and 5mm]
or \usetikzlibrary{positioning}(?) and "[above=1cm of <node name>]"
- To draw a grid (millimetric paper):
\draw[step=.1cm,lightgray,very thin] (0,0) grid (15,15);
\draw[step=1cm,gray,thin] (0,0) grid (15,15);
- Change the opacity of an object: [draw opacity=0.5]
- Make a gradient: \usetikzlibrary{fadings} + [left color=#1!10,right color=#1!90]
- Add a shadow: \usetikzlibrary{shadows} + [rectangle, drop shadow={opacity=0.25,color=#1!50}]
- To create a style for all objects of a type:
\begin{tikzpicture}[abox/.style={draw=black,thick,font=\bf}]
- To parametrize the style:
\begin{tikzpicture}[abox/.style args={<args pattern>, e.g. #1/#2/#3}{draw=#1,text=#2,text width=#3,font=\bf}, hardware/.style={abox=blue/black/2cm}]
- To modify an existing style: \begin{tikzpicture}[*every* abox/.style...]
- To make calculations (-/+ only) on coordinates: \usetikzlibrary{calc} + \node[...] (A) at ($ (0,0) + .1*(rand,rand) $);
- Thanks to TikZ it is possible to separate the elements (\node) from their presentation (style) and placement (\matrix)
- To draw the bounding box as seen by LaTeX and created by TikZ: add, AT THE END:
\draw[thick] (current bounding box.south west) rectangle
(current bounding box.north east);
- (252)Come back to normal font in italic mode
\normalfont
- (267)To generate the pics in their BoundingBoxes, rather than a full page in TikZ
\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\newlength{\imagewidth}
\newlength{\imagescale}
- (271)How to manage un-hyphened words without breaking penalties, etc.
1. Writing an article, I used the word "émerge" and it appeared at the end of a line totally outboxed.
You can reproduce a similar situation using a4paper and babel French, making a paragraph filled with "émerge" words. The tenth occurence will not be hyphenized and will appear on the second line (difference with my case in which it appeared outboxed on the first line) whereas it should be possible to hyphenize the first "é-" on the first line and the "-merge" and the second line.
2. Using é\-mer\-ge would do the job. However, trying to make the solution more global using "\hyphenation{é-mer-ge}" in the preamble of the document does not work.
3. I'm sure playing with penalties would work, but I would fear using such an intrusive solution in a full article.
4. Juan told me about the following package, with the following options:
\usepackage[babel=true,kerning=true,protrusion=true,spacing=true,expansion=true,tracking=true]{microtype}
It seems that it works like word, playing with the size of the spaces between the words (and even with the size of the letters?) nut the result is pretty.
- (276)T1 vs. OT1 fonts
The default LaTeX font encoding is OT1, the encoding of the original Computer Modern TeX font. It contains only the 128 characters of the 7-bit ASCII character set. When accented characters are required, TeX creates them by combining a normal character with an accent. While the resulting output looks perfect, this approach stops the automatic hyphenation from working inside words containing accented characters. Besides, some of Latin letters could not be created by combining a normal character with an accent, to say nothing about letters of non-Latin alphabets, such as Greek or Cyrillic.
Conclusion: it's better use T1 fonts
From: http://en.wikibooks.org/wiki/LaTeX/Internationalization
- (283)How to make a scientific conference poster?
Just use both a0poster and textpos packages:
http://www.tex.ac.uk/CTAN/macros/latex/contrib/textpos/textpos.html
http://nxg.me.uk/docs/posters/
The philosophy is quite simple: you write textboxes that you place on a grid.
- (318)What to do in Beamer or Moderncv when the French "guillemet" has to be used at the begining of an item?
When in beamer using:
\item <<~test~>> do not work in beamer
or in moderncv:
\cventry{date}
{title}
{Project}
{}
{<<~place~>>}
{content}
it will not work, as < is mistakenly interpreted.
=>you have to force a space after the class's command:
in beamer: \item\ <<~test~>>
in moderncv:
\cventry{date}
{title}
{Project}
{}
{\ <<~place~>>}
{content}
- (321)How to use colors in tables with \multicolumns?
\begin{table}
\begin{tabular}{ccc}
\rowcolor[rgb]{1,0,0}
Hello & \multicolumn{2}{>{\columncolor[rgb]{1,0,0}}c}{Goodbye}
\end{tabular}
\end{table}
- (322)How to make breakable tables?
\usepackage{longtable} and use \begin{longtable} rather of \begin{tabular}
- (323)How to print the value of a counter or length?
You can insert the value of a variable with \the:
\the\oddsidemargin
- (331)What is the minimal list of document to learn/use LaTeX?
Apprends_LaTeX.pdf
Beamer3.pdf
FAQ_www.tex.ac.uk
JMPL.ps.gz
TikZ-Impatient.pdf
beameruserguide.pdf
bibstyles.html
bibstyles.pdf
downes-short-math-guide.pdf
epslatex.pdf
latex_maths+pix.pdf
lshort.pdf
lxmanuel.pdf
pgfmanual.pdf
symbols-a4.pdf
symbols-letter.pdf
textpos.pdf
Tutorial_www.andy-roberts.net
WikiBooks_LaTeX.pdf
advancedlatex.ps
guide-local.pdf
latex-introduction.pdf
mil.pdf
usrguide.pdf
visualFAQ.pdf
- (337)How to change the name of the bibliography?
\renewcommand{\bibname}{Journal2}
\renewcommand{\refname}{Journal2}
- (363)A basic LaTeX file for Beamer presentation
\documentclass[french,t,% 't' (resp. 'c') places text vertically at top/center of the slides
% PDF settings
hyperref={%
pdftitle={...},%
pdfauthor={...},%
pdfsubject={...},%
pdfkeywords={...}%
},%
% To load many pre-defined color names
xcolor={pdftex,svgnames}, % dvipsnames, dvipsnames*, svgnames, svgnames*, x11names,
]{beamer} %
\usetheme{default} % AnnArbor,Antibes,Bergen,Berkeley,Berlin,Boadilla,CambridgeUS,Copenhagen,Darmstadt,Dresden,Frankfurt,Goettingen,Hannover,Ilmenau,JuanLesPins,Luebeck,Madrid,Malmoe,Marburg,Montpellier,PaloAlto,Pittsburgh,Rochester,Singapore,Szeged,Warsaw,boxes,default
% Correct French/English indentation and splitting of words
\usepackage{babel}
% Correct management of accentuated chars in input file
\usepackage[latin1]{inputenc}
%\usepackage[utf8]{inputenc}
% Correct font for the generation of docs with accentuated chars
\usepackage[T1]{fontenc} % Can handle hyphenation of words with accented characters
%%\usepackage[OT1]{fontenc} % Might generated bad looking PDFs
% Access to many maths symbols
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amsfonts}
% Insertion of images generated by external tools
\usepackage{graphicx}
% To generate pretty & scalable images directly in LaTeX
\usepackage{tikz}
% \draw[decorate,decoration={coil,amplitude=1.5cm, segment length=.4cm}] (5,5.5) -- (5,1.5) ;
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.pathmorphing,snakes}
% To print numbers correctly
\usepackage{numprint}
% Info for title page
\title[<short>]{...}
\author[<short>]{... \and ... \inst{2}}
\institute[<short>]{
\inst{1}%
...
\and
\inst{2}%
...}
\date[<short>]{\today{}}
\subject{...}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
% The title page
\begin{frame}
\titlepage
\end{frame}
% The TOC
\begin{frame}{Table of contents}
\tableofcontents
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\part{}
\section{}
\subsection{}
% First slide
\begin{frame}{...}
\only<1-2>{...} % Shows the elements greyed when slide(s) is not the one indicated
\uncover<3->{...} % Only shows the elements when slide(s) is the one indicated
\begin{figure}
\begin{center}
\includegraphics[width=0.65\textwidth]{...}
\end{center}
\end{figure}
\begin{block}{Un bloc normal}
Texte du block \texttt{block}
\end{block}
\begin{alertblock}{Un bloc très alerte}
Texte du block \texttt{alertblock}
\end{alertblock}
\begin{exampleblock}{Un bloc exemplaire}
Exemple de block \texttt{exampleblock}
\end{exampleblock}
\begin{definition}
environnement definition
\end{definition}
\begin{example}
environnement example
\end{example}
\begin{proof}
environnement proof
\end{proof}
\begin{theorem}
environnement theorem
\end{theorem}
\end{frame}
\begin{columns}[options] % 't' (resp. 'c') places text vertically at top/center of the slides
\begin{column}[t]{0.40\textwidth}
contenu
\end{column}
\begin{column}[c]{0.59\textwidth}
contenu
\end{column}
\end{columns}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
- (364)A basic file for an article/report/book
\documentclass[11pt,french,a4paper,twoside]{article} % draft % report/book
\usepackage{hyperref}
\hypersetup{%
pdftitle={...},%
pdfauthor={...},%
pdfsubject={...},%
pdfkeywords={...}%
}
% To load many pre-defined color names
\usepackage[pdftex,svgnames]{xcolor} % dvipsnames, dvipsnames*, svgnames, svgnames*, x11names,
% Correct French/English indentation and splitting of words
\usepackage{babel}
% Correct management of accentuated chars in input file
\usepackage[latin1]{inputenc}
%\usepackage[utf8]{inputenc}
% Correct font for the generation of docs with accentuated chars
\usepackage[T1]{fontenc} % Can handle hyphenation of words with accented characters
%%\usepackage[OT1]{fontenc} % Might generated bad looking PDFs
% Access to many maths symbols
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amsfonts}
% Insertion of images generated by external tools
\usepackage{graphicx}
% To generate pretty & scalable images directly in LaTeX
\usepackage{tikz}
% \draw[decorate,decoration={coil,amplitude=1.5cm, segment length=.4cm}] (5,5.5) -- (5,1.5) ;
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.pathmorphing,snakes}
% To print numbers correctly
\usepackage{numprint}
\usepackage{vmargin}
%\setpapersize{A4}
%\setmarginsrb{ leftmargin }{ topmargin }{ rightmargin }{ bottommargin }{ headheight }{ headsep }{ footheight }{ footskip }
%\setmargrb{ leftmargin }{ topmargin }{ rightmargin }{ bottommargin }%
%%\pagestyle{empty}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
% The title page
% Info for title page
\title[<short?>]{...}
\author[<short?>]{...}
\date[<short?>]{\today{}}
\maketitle
% The TOC
\tableofcontents
\part{}
%\chapter{} %% For report/book
\section{}
\subsection{}
\subsubsection{}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
- (473)How to access quickly the documentation of a LaTeX package?
texdoc <pkg name>
texdoc texdoc
texdoc beamer
From: http://www.planet-libre.org/post/10552
- (500)How to make integer/float computations?
\usepackage{pgf}
\pgfmathsubtract{.1}{.3}
\pgfmathresult
- (530)The modified "moderncv.cls" that allows to set the ratio of space for the columns in \cvlanguage
%% start of file `moderncv.cls'.
%% Copyright 2006-2010 Xavier Danaux (xdanaux@gmail.com).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
%-------------------------------------------------------------------------------
% identification
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{moderncv}[2010/05/24 v0.8 modern curriculum vitae document class]
%-------------------------------------------------------------------------------
% debugging
%-------------------------------------------------------------------------------
\newif\if@DEBUG\@DEBUGfalse
%-------------------------------------------------------------------------------
% class options
%
% (need to be done before the external package loading, for example because
% we need \paperwidth, \paperheight and \@ptsize to be defined before loading
% geometry and fancyhdr)
%-------------------------------------------------------------------------------
% paper size option
\DeclareOption{a4paper}{
\setlength\paperheight{297mm}
\setlength\paperwidth{210mm}}
\DeclareOption{a5paper}{
\setlength\paperheight{210mm}
\setlength\paperwidth{148mm}}
\DeclareOption{b5paper}{
\setlength\paperheight{250mm}
\setlength\paperwidth{176mm}}
\DeclareOption{letterpaper}{
\setlength\paperheight{11in}
\setlength\paperwidth{8.5in}}
\DeclareOption{legalpaper}{
\setlength\paperheight{14in}
\setlength\paperwidth{8.5in}}
\DeclareOption{executivepaper}{
\setlength\paperheight{10.5in}
\setlength\paperwidth{7.25in}}
\DeclareOption{landscape}{
\setlength\@tempdima{\paperheight}
\setlength\paperheight{\paperwidth}
\setlength\paperwidth{\@tempdima}}
% font size options
\newcommand\@ptsize{}
\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
% draft/final option
\DeclareOption{draft}{\setlength\overfullrule{5pt}}
\DeclareOption{final}{\setlength\overfullrule{0pt}}
% nolmodern option
\newif\if@lmodern\@lmoderntrue
\DeclareOption{nolmodern}{\@lmodernfalse}
% nocolor option
\newif\if@color\@colortrue
\DeclareOption{nocolor}{\@colorfalse}
% CJK option
%\newif\if@CJK\@CJKfalse
%\DeclareOption{CJK}{\@CJKtrue}
% execute default options
\ExecuteOptions{a4paper,11pt,color,final}
% process given options
\ProcessOptions\relax
\input{size1\@ptsize.clo}
%-------------------------------------------------------------------------------
% required packages
%-------------------------------------------------------------------------------
% \AtEndPreamble hook (loading tetoolbox instead of defining the macro, as to avoid incompatibilities with etoolbox (and packages relying on it) defining the macro too)
\RequirePackage{etoolbox}
%\let\@endpreamblehook\@empty
%\def\AtEndPreamble{\g@addto@macro\@endpreamblehook}
%\let\moderncv@document\document
%\def\document{\endgroup\@endpreamblehook\begingroup\moderncv@document}
% if... then... else... constructs
\RequirePackage{ifthen}
% pdf vs ps compilation
\RequirePackage{ifpdf}
% color
\ifpdf
\RequirePackage[pdftex]{color}
\else
\RequirePackage[dvips]{color}
\fi
% font encoding
\RequirePackage[T1]{fontenc}
% scalable Computer Modern fonts
%\usepackage{type1cm}
% latin modern fonts
%\AtEndOfClass{%
\if@lmodern
\RequirePackage{lmodern}\fi%}
% symbols like \Telefon, \Mobilefone, \Letter and \Email
\RequirePackage{marvosym}
% extended characters of T1 in .ps + other guillemets
%\RequirePackage{ae,aecompl,aeguill}
% page geometry
\addtolength{\oddsidemargin}{-54pt}
\addtolength{\textwidth}{109pt}
\addtolength{\topmargin}{-70pt}
\addtolength{\textheight}{122pt}
\addtolength{\marginparsep}{-5pt}
\addtolength{\marginparwidth}{-10pt}
% hyperrefs
\RequirePackage{url}
\urlstyle{tt}
% load hyperred at the end of the preamble to pass options required by loaded packages (like CJK)
\AtEndPreamble{
\@ifpackageloaded{CJK}
{
\ifpdf\RequirePackage[pdftex,CJKbookmarks]{hyperref}
\else\RequirePackage[dvips,CJKbookmarks]{hyperref}\fi}
{
\ifpdf\RequirePackage[pdftex]{hyperref}
\else\RequirePackage[dvips]{hyperref}\fi}
\AtBeginDocument{
\hypersetup{
breaklinks,
baseurl = http://,
pdfborder = 0 0 0,
pdfpagemode = UseNone,% do not show thumbnails or bookmarks on opening
% pdfstartview = FitH,
pdfstartpage = 1,
pdfcreator = \LaTeX{} with `moderncv' package,
pdfproducer = \LaTeX{},
bookmarksopen = true,
pdfauthor = \@firstname~\@familyname,
pdftitle = \@title,
pdfsubject = \@firstname~\@familyname,
pdfkeywords = \@firstname~\@familyname{} curriculum vit\ae{}}}
\pagenumbering{arabic}% has to be issued after loading hyperref
}
% graphics
\ifpdf
\RequirePackage[pdftex]{graphicx}
\else
\RequirePackage[dvips]{graphicx}\fi
% GM: For float number computations
\RequirePackage{pgf}
% headers and footers
\RequirePackage{fancyhdr}
\fancypagestyle{plain}{
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhf{}}
\pagestyle{plain}
% compatibility package with older versions of moderncv
\RequirePackageWithOptions{moderncvcompatibility}
%-------------------------------------------------------------------------------
% class definition
%-------------------------------------------------------------------------------
% minimal base settings
\setlength\lineskip{1\p@}
\setlength\normallineskip{1\p@}
\renewcommand\baselinestretch{}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\setlength\columnsep{10\p@}
\setlength\columnseprule{0\p@}
% TO BE TESTED
%\setlength\arraycolsep{5\p@}
%\setlength\tabcolsep{6\p@}
%\setlength\arrayrulewidth{.4\p@}
%\setlength\doublerulesep{2\p@}
%\setlength\tabbingsep{\labelsep}
%\setlength\fboxsep{3\p@}
%\setlength\fboxrule{.4\p@}
\pagestyle{empty}
\raggedbottom
\onecolumn
%-------------------------------------------------------------------------------
% style commands definitions
%-------------------------------------------------------------------------------
% symbols used
\providecommand*{\listitemsymbol}{\Neutral}%{{\fontencoding{U}\fontfamily{ding}\selectfont\tiny\symbol{'102}}}
\providecommand*{\addresssymbol}{}
\providecommand*{\mobilesymbol}{\Mobilefone}
\providecommand*{\phonesymbol}{\Telefon}
\providecommand*{\faxsymbol}{\FAX}
\providecommand*{\emailsymbol}{\Letter}
\providecommand*{\homepagesymbol}{{\Large\ComputerMouse}}
% colors
\definecolor{firstnamecolor}{rgb}{0,0,0}
\definecolor{familynamecolor}{rgb}{0,0,0}
\definecolor{titlecolor}{rgb}{0,0,0}
\definecolor{addresscolor}{rgb}{0,0,0}
\definecolor{quotecolor}{rgb}{0,0,0}
\definecolor{sectionrectanglecolor}{rgb}{0,0,0}
\definecolor{sectiontitlecolor}{rgb}{0,0,0}
\definecolor{subsectioncolor}{rgb}{0,0,0}
\definecolor{hintcolor}{rgb}{0,0,0}
% fonts
\providecommand*{\firstnamefont}{}
\providecommand*{\familynamefont}{}
\providecommand*{\titlefont}{}
\providecommand*{\addressfont}{}
\providecommand*{\quotefont}{}
\providecommand*{\sectionfont}{}
\providecommand*{\subsectionfont}{}
\providecommand*{\hintfont}{\small\sffamily}
% styles
\providecommand*{\firstnamestyle}[1]{{\firstnamefont\color{firstnamecolor}#1}}
\providecommand*{\familynamestyle}[1]{{\familynamefont\color{familynamecolor}#1}}
\providecommand*{\titlestyle}[1]{{\titlefont\color{titlecolor}#1}}
\providecommand*{\addresstyle}[1]{{\addressfont\color{addresscolor}#1}}
\providecommand*{\quotestyle}[1]{{\quotefont\color{quotecolor}#1}}
\providecommand*{\sectionstyle}[1]{{\sectionfont\color{sectiontitlecolor}#1}}
\providecommand*{\subsectionstyle}[1]{{\subsectionfont\color{subsectioncolor}#1}}
\providecommand*{\hintstyle}[1]{{\hintfont\color{hintcolor}#1}}
% themes: casual (default), classic, ...
\newcommand*{\moderncvtheme}[2][]{
\def\@moderncvtheme{#2}
\def\@moderncvthemeoptions{#1}}
\moderncvtheme{casual}% default theme
\AtEndPreamble{\RequirePackage[\@moderncvthemeoptions]{moderncvtheme\@moderncvtheme}}
%-------------------------------------------------------------------------------
% structure commands definitions
%-------------------------------------------------------------------------------
\newcommand*{\firstname}[1]{\def\@firstname{#1}}
\newcommand*{\familyname}[1]{\def\@familyname{#1}}
\renewcommand*{\title}[1]{\def\@title{#1}}
\newcommand*{\address}[2]{\def\@addressstreet{#1}\def\@addresscity{#2}}
\newcommand*{\mobile}[1]{\def\@mobile{#1}}
\newcommand*{\phone}[1]{\def\@phone{#1}}
\renewcommand*{\fax}[1]{\def\@fax{#1}}
\newcommand*{\email}[1]{\def\@email{#1}}
\newcommand*{\homepage}[1]{\def\@homepage{#1}}
\newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}}
\def\@photowidth{0pt}
\newcommand*{\photo}[2][64pt]{\def\@photowidth{#1}\def\@photo{#2}}
\newcommand*{\quote}[1]{\def\@quote{#1}}
% length used by the moderncv layout
% quote length
\newlength{\quotewidth}
% section lengths
\newlength{\hintscolumnwidth}
\newlength{\separatorcolumnwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth}
\newlength{\maincolumnwidth}
% doubleitem lengths
\newlength{\doubleitemmaincolumnwidth}
% listitem lengths
\newlength{\listitemsymbolwidth}
\settowidth{\listitemsymbolwidth}{\listitemsymbol{}~}
\newlength{\listitemmaincolumnwidth}
% listdoubleitem lengths
\newlength{\listdoubleitemmaincolumnwidth}
% recompute all the lengths that depends on the text width
\newcommand{\doubleitemcolumnratio}{.5} % GM
\pgfmathsubtract{1}{\doubleitemcolumnratio} % GM
\newcommand{\doubleitemcolumnratioc}{\pgfmathresult} % GM
\newcommand{\cvlanguageratio}{.5} % GM
\pgfmathsubtract{1}{\cvlanguageratio} % GM
\newcommand{\cvlanguageratioc}{\pgfmathresult} % GM
\newcommand*{\recomputethemelengths}{}
\newcommand*{\recomputelengths}{%
\setlength{\quotewidth}{0.65\textwidth}%
% main lenghts
\setlength{\maincolumnwidth}{\textwidth}%
\addtolength{\maincolumnwidth}{-\separatorcolumnwidth}%
\addtolength{\maincolumnwidth}{-\hintscolumnwidth}%
% listitem lengths
\setlength{\listitemmaincolumnwidth}{\maincolumnwidth}%
\addtolength{\listitemmaincolumnwidth}{-\listitemsymbolwidth}%
% doubleitem lengths
\setlength{\doubleitemmaincolumnwidth}{\maincolumnwidth}%
\addtolength{\doubleitemmaincolumnwidth}{-\hintscolumnwidth}%
\addtolength{\doubleitemmaincolumnwidth}{-\separatorcolumnwidth}%
\setlength{\doubleitemmaincolumnwidth}{\doubleitemcolumnratio\doubleitemmaincolumnwidth}% GM
% listdoubleitem lengths
\setlength{\listdoubleitemmaincolumnwidth}{\maincolumnwidth}%
\addtolength{\listdoubleitemmaincolumnwidth}{-\listitemsymbolwidth}%
\setlength{\listdoubleitemmaincolumnwidth}{0.475\listdoubleitemmaincolumnwidth}%
% fancyhdr lengths
\renewcommand{\headwidth}{\textwidth}%
\recomputethemelengths}
\setlength{\hintscolumnwidth}{0.15\textwidth}
\recomputelengths
% makes the cv title
%\newcommand*{\maketitle}{}%
\title{}% to avoid LaTeX complaining that \maketitle is a called without first a call to \title
% draws a colored rectangle
% usage: \colorrule[optional height]{width}
%\newcommand*{\colorrule}[2][1ex]{{\color{sectionrectanglecolor}{\rule{#2}{#1}}}}
% usage: \section{<title>}
\newcommand*{\section}[1]{%
\vspace*{2.5ex}%
\parbox[m]{\hintscolumnwidth}{\raggedleft\hintfont{\color{sectionrectanglecolor}\rule{\hintscolumnwidth}{1ex}}}%
\phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{part}{#1}%
\hspace{\separatorcolumnwidth}%
\parbox[m]{\maincolumnwidth}{\sectionstyle{#1}}\\[1ex]}
% \cvline[1ex]{\color{sectionrectanglecolor}\rule[0]{\hintscolumnwidth}{1ex}}{\sectionstyle{#1}}}% gives bad alignment of rectangle; too bad m{width} columns seem not to work as a valid column definition for tabular environments
% starred variant, which is identical but defined to allow its use (e.g. for natbib compatibility, who uses \section*{} for the bibliography header)
\AtEndPreamble{%
\@ifpackageloaded{natbib}
{
\RequirePackage{suffix}
\WithSuffix\newcommand\section*{\section}
}{}
}
% usage: \subsection{title}
\newcommand*{\subsection}[1]{%
\cvline[0.5ex]{}{%
\subsectionstyle{#1}%
% \phantomsection{}% reset the anchor for hyperrefs
% \addcontentsline{toc}{chapter}{#1}% does not work, the bookmark is placed at the same level as sections (placed themselves at part level to be visible, as hyperref does not allow sections without parents...)
}}
% usage: \cvline{margintext}{linetext}
\newcommand*{\cvline}[3][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\raggedleft\hintfont{#2} &{#3}%
\end{tabular}\\[#1]}
% usage: \cvdoubleitem{subtitle}{text}{subtitle}{text}
\newcommand*{\cvdoubleitem}[4]{%
\cvline{#1}{\begin{minipage}[t]{\doubleitemmaincolumnwidth}#2\end{minipage}%
\hfill%
\begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintfont{#3}\end{minipage}\hspace*{\separatorcolumnwidth}\begin{minipage}[t]{\doubleitemmaincolumnwidth}#4\end{minipage}}}
% usage: \cvlistitem[symbol]{point1}
\newcommand*{\cvlistitem}[2][\listitemsymbol{}]{%
\cvline[0pt]{}{#1~\begin{minipage}[t]{\listitemmaincolumnwidth}#2\end{minipage}}}
% usage: \cvlistdoubleitem[symbol]{point1}{point2}
\newcommand*{\cvlistdoubleitem}[3][\listitemsymbol{}]{%
\cvline[0pt]{}{#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}%
\hfill%
\ifthenelse{\equal{#3}{}}%
{}%
{#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#3\end{minipage}}}}
% usage: \cventry{years}{degree/job title}{institution/employer}{localization}{optionnal: grade/...}{optional: comment/job description}
\newcommand*{\cventry}[6]{%
\cvline{#1}{%
{\bfseries#2}%
\ifthenelse{\equal{#3}{}}{}{, {\slshape#3}}%
\ifthenelse{\equal{#4}{}}{}{, #4}%
\ifthenelse{\equal{#5}{}}{}{, #5}%
.%
\ifx&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi%
}}%
% usage (inside 'language' cvsection environment): \cvlanguage{name}{level}{comment}
\newcommand*{\cvlanguage}[3]{%
\cvline{#1}{\begin{minipage}[t]{\cvlanguageratio\maincolumnwidth}\textbf{#2}\end{minipage}\hfill\begin{minipage}[t]{\cvlanguageratioc\maincolumnwidth}\raggedleft\footnotesize\itshape #3\end{minipage}}} %GM
% usage (inside 'computer skills' cvsection environment): \cvcomputer{category}{programs}{category}{programs}
\newcommand*{\cvcomputer}[4]{%
\cvdoubleitem{#1}{\small#2}{#3}{\small#4}}
% usage: \link[optional text]{link}
\newcommand*{\link}[2][]{%
\ifthenelse{\equal{#1}{}}%
{\href{#2}{#2}}%
{\href{#2}{#1}}}
% usage: \httplink[optional text]{link}
\newcommand*{\httplink}[2][]{%
\ifthenelse{\equal{#1}{}}%
{\href{http://#2}{#2}}%
{\href{http://#2}{#1}}}
% usage: \emaillink[optional text]{link}
\newcommand*{\emaillink}[2][]{%
\ifthenelse{\equal{#1}{}}%
{\href{mailto:#2}{#2}}%
{\href{mailto:#2}{#1}}}
% usage: \nopagenumbers{}
\newif\if@displaypagenumbers\@displaypagenumberstrue
\newcommand*{\nopagenumbers}{\@displaypagenumbersfalse}
\AtEndPreamble{%
\AtBeginDocument{%
\if@displaypagenumbers%
\@ifundefined{r@lastpage}{}{%
\ifthenelse{\pageref{lastpage} > 1}{%
\fancypagestyle{plain}{%
\fancyfoot[r]{\addressfont\color{quotecolor}\footnotesize\thepage/\pageref{lastpage}}}%
\pagestyle{plain}}{}}%
\AtEndDocument{\label{lastpage}}\else\fi}}
% thebibliography environment, for use with BibTeX and possibly multibib
\newcommand{\refname}{Publications}
\newlength{\bibindent}
\setlength{\bibindent}{1.5em}
% bibliography item label
\newcommand*{\bibliographyitemlabel}{}% use \@biblabel{\arabic{enumiv}} for BibTeX labels
%\newif\if@multibibfirstbib\@multibibfirstbibfalse
% bibliography head (section, etc}, depending on whether multibib is used
\newcommand*{\bibliographyhead}[1]{\section{#1}}
\AtEndPreamble{\@ifpackageloaded{multibib}{\renewcommand*{\bibliographyhead}[1]{\subsection{#1}}}{}}
% thebibliography environment definition
\newenvironment{thebibliography}[1]%
{%
\bibliographyhead{\refname}%
\small%
\begin{list}{\bibliographyitemlabel}%
{%
\setlength{\topsep}{0pt}%
\setlength{\labelwidth}{\hintscolumnwidth}%
\setlength{\labelsep}{\separatorcolumnwidth}%
\leftmargin\labelwidth%
\advance\leftmargin\labelsep%
\@openbib@code%
\usecounter{enumiv}%
\let\p@enumiv\@empty%
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy\clubpenalty4000\widowpenalty4000%
% \sfcode`\.\@m%
% \sfcode `\=1000\relax%
}%
{%
\def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
\end{list}%
}
\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
\let\@openbib@code\@empty
% itemize, enumerate and description environment
\setlength{\leftmargini} {1.2em}
\leftmargin\leftmargini
\setlength{\leftmarginii} {1em}
\setlength{\leftmarginiii} {1.87em}
\setlength{\leftmarginiv} {1.7em}
\setlength{\leftmarginv} {1em}
\setlength{\leftmarginvi} {1em}
\setlength{\labelsep} {.5em}
\setlength{\labelwidth} {\leftmargini}
\addtolength{\labelwidth} {-\labelsep}
\@beginparpenalty -\@lowpenalty
\@endparpenalty -\@lowpenalty
\@itempenalty -\@lowpenalty
% itemize labels
\newcommand\labelitemi{\listitemsymbol{}}
\newcommand\labelitemii{{\large\bfseries-}}
\newcommand\labelitemiii{\textperiodcentered}%{\textasteriskcentered}
\newcommand\labelitemiv{\textperiodcentered}
% enumerate labels
\renewcommand\theenumi{\@arabic\c@enumi}
\renewcommand\theenumii{\@alph\c@enumii}
\renewcommand\theenumiii{\@roman\c@enumiii}
\renewcommand\theenumiv{\@Alph\c@enumiv}
\newcommand\labelenumi{\theenumi.}
\newcommand\labelenumii{(\theenumii)}
\newcommand\labelenumiii{\theenumiii.}
\newcommand\labelenumiv{\theenumiv.}
\renewcommand\p@enumii{\theenumi}
\renewcommand\p@enumiii{\p@enumii(\theenumii)}
\renewcommand\p@enumiv{\p@enumiii\theenumiii}
% description label
\newcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\bfseries#1}
% hooks to adjust spacing (idea by Jakob Schiøtz; see http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/tweaklist.sty)
\RequirePackage{tweaklist}% distributed with moderncv, not found on ctan and slightly modified
\renewcommand*{\itemhook}{
\setlength{\topsep}{0pt}%
\setlength{\itemsep}{0pt}}
\renewcommand*{\enumhook}{\itemhook{}}
\renewcommand*{\deschook}{\itemhook{}}
% classical \today definition
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day, \number\year}
\endinput
%% end of file `moderncv.cls'.
- (575)How to split an image in sevarl parts (e.g., print A0poster into A4 sheets)?
I had to split a map design into more pieces to fit A4 paper recently. I used Imagemagick - it's THE tool for doing such repetitive image tasks for me. It's command-line only, so that may dissuade some users, but for me, it's a plus.
To split an image into 2088x2953-pixel sub-images, you just have to execute something like this: "convert -crop 2088x2953 final_3.jpg a4_%d.jpg"
or
http://posterazor.sourceforge.net/index.php?page=screenshots&lang=english
From: http://boardgamegeek.com/thread/503605/easy-split-a3-to-a4-and-few-more-things
or
http://pdfposter.origo.ethz.ch/
From: http://nxg.me.uk/docs/posters/
- (577)How to solve encoding problems between [X]emacs and aspell
(a.k.a. "aspell and its process have different coding maps")?
In /etc/aspell.conf or ~/.aspell.conf add the following line:
encoding iso-8859-15
From: http://forum.ubuntu-fr.org/viewtopic.php?id=122209
Also to be tested:
http://superuser.com/questions/191271/ispell-and-its-process-have-different-character-maps
- (600)How to add some space between bibitems when using bibTeX?
Before the bib commands, add (.6\baselineskip represents the space to add):
\makeatletter
\newcommand{\adjustmybblparameters}{\setlength{\itemsep}{.6\baselineskip}\setlength{\parsep}{0pt}}
\let\ORIGINALlatex@openbib@code=\@openbib@code
\renewcommand{\@openbib@code}{\ORIGINALlatex@openbib@code\adjustmybblparameters}
\makeatother
From: ftp://ftp.tex.ac.uk/tex-archive/biblio/bibtex/contrib/doc/btxFAQ.pdf\usepackage{xifthen}
\newcounter{dobyear}\setcounter{dobyear}{ }
%fill in your birth~s year above
\newcounter{dobmonth}\setcounter{dobmonth}{ }
%fill in your birth~s month in numeric value above
\newcounter{dobday}\setcounter{dobday}{ }
%fill in your birth~s day above
\newcounter{age}\setcounter{age}{\the\year %G~??%@ \thedobyear}
%this compares your~s birth year to the current year and stores the value in a new counter
\newtest{\conditiona}{%
\cnttest{\the\month}{=}{\thedobmonth} \AND %
\cnttest{\the\day}{>=}{\thedobday}%
}
%this sets the condition -Y´if the current month is the same as your birth month and the current day is greater or equal than your birth day
\newtest{\conditionb}{%
\cnttest{\the\month}{>}{\thedobmonth}%
}
%this sets the condition: ´if we the current month is after your birth month´
\ifthenelse{\conditiona \OR \conditionb}{}{\addtocounter{age}{-1}}
%this adjusts your age if one of the two conditions above is true, i.e. current time is later than your birthday of this year.
- (693)Basic LaTeX Makefile
clean:
rm -f *~ *.log *.aux *.nav *.out *.snm *.toc *.pdf *.ps
rm -fr auto/
%pdf: %tex
pdflatex $< && pdflatex $<
- (257)Set backup dir
(setq bkup-backup-directory-info '( (t "~/.xemacs_backup/" full-path prepend-name search-upward)))
- (258)Modify mode options by hooking on file extension
(add-hook 'text-mode-hook 'myctextmode) ; no-conversion,raw-text,undecided,utf-8,iso-8859-1,ctext
(defun myctextmode ()
(set-buffer-file-coding-system 'ctext)
)
(add-hook 'latex-mode-hook 'mylatexmode)
(defun mylatexmode ()
"Sets LaTeX mode properly"
(interactive)
(command-execute (quote LaTeX-install-toolbar))
(command-execute (quote LaTeX-mode))
(command-execute (quote font-lock-mode))
(command-execute (quote font-lock-mode))
(command-execute (quote font-lock-mode))
)
- (259)Adding a file extension
(add-to-list 'auto-mode-alist '("\\.tikz$" . LaTeX-mode))
- (260)Insertion of comments
tu peux aussi utiliser M-; (comment-dwim) dwim -> do-what-i-mean.
Thanks to Juan
- (261)Save a configuration of the frames into a register
Ahh, puis aussi pour garder une configuration de ta fenêtre dans un registre, c'est pratique, surtout si tu veux basculer entre plusieurs modes de travail (M-x window-configuration-to-register)
Thanks to Juan
- (262)Move from/to start/end of a region
Il y a un truc que j'utilise pas mal, c'est C-x C-x, ça te permet de basculer entre debut et fin d'une région (même si elle n'est pas sélectionnée), p. ex. si tu viens de faire un C-y, tu fais un C-x C-x puis C-M-\ et la région est indentée. Puis un mode que je trouve pas mal est icomplete (c'est la completion pour les commandes).
- (41)Count total/current number of chars
The command C-x = (what-cursor-position) provides information about
point and about the column the cursor is in. It prints a line in the
echo area that looks like this:
Char: x (0170) point=65986 of 563027(12%) column 44
(In fact, this is the output produced when point is before `column 44'
in the example.)
The two values after `Char:' describe the character following point,
first by showing it and second by giving its octal character code.
`point=' is followed by the position of point expressed as a character
count. The front of the buffer counts as position 1, one character
later as 2, and so on. The next, larger number is the total number of
characters in the buffer. Afterward in parentheses comes the position
expressed as a percentage of the total size.
- (49)Files Encoding
See keywords:
-> set-buffer-file-coding-system (CTL-x RET f ISO-8859-1)
-> et file-coding-system pour 'file-names' ?
- (50)How to enter a newline character in a regex?
Type C-q C-j to enter a newline character (at the query-replace prompt).
- (52)Copy / Cut rectangles of text (e.g., table column!, thanks to Vaillant Jerome)
Pour ajouter un rectangle de texte (comme par exemple "// " en debut
de ligne) : marquer le coin supérieur gauche du rectangle avec
"M-space" puis deplacez vous au coin inférieur droit et faites un "C-x
C-r t" puis taper votre texte dans le minibuffer. C-x C-r est
associable aux autres commandes d'édition : C-x C-r k coupe le
rectangle selectionne et C-x C-r y le colle (a partir de la position
courante du curseur)
SOUS XEMACS C'est C-x r t !!
http://linuxfr.org/tips/152.html
- (53)Open compressed files
Cette ligne (à mettre dans .emacs) permet à emacs d'acceder de manière
transparente aux fichiers compressés. (auto-compression-mode 1) foX
- (54)Replace RegExp
In replace-regexp, the newstring need not be constant. It can refer to
all or part of what is matched by the regexp.
`\&' in newstring stands for the entire text being replaced.
`\d' in newstring, where d is a digit, stands for whatever matched the
d'th __parenthesized (with "\(" and "\)")__ grouping in regexp.
par exemple : C-M-% \(\w*\) RET '\1' remplace "mot" par "'mot'"
- (55)ESC-<value> (used to repeat commands or set vars)
ESC-<chiffre> <cmd>
=> reprete <chiffre> fois la commande
ESC-<chiffre> CTL-x f
=> definit la variable de position de column pour ESC-q.
La fonciton associée est function set-fill-column
- (56)Undo M-q
>M> Hello,
>M> Is there a way to undo the effect of M-q (fill-paragraph)? I like to
>M> write my blog post with emacs, and use M-q to make the text more
>M> readable, but when I copy the text into "blogger" I need to remove
>M> line breaks. Thanks for any help.
Use longlines-mode instead of fill-paragraph.
Solution crade : ESC-<tres gros chiffre> CTL-X F puis ESC-Q sur les
paragraphes (cf plus haut pour le nom de la fonction)
- (42)Selecting the current function/method (cc/jde-mode, thanks to pappy)
use C-M-h
It calls the lisp function (mark-defun)
http://linuxfr.org/tips/60.html
- (43)Coding system (ISO-8859-1 and UTF-8) and hooks
If you add
(modify-coding-system-alist 'file "mon_projet" 'iso-latin-1)
to your .xemacs/custom.el , then al the files containing "mon_projet" will use
latin-1 as default (i.e. iso-8859-1)
Also, see keywords:
-> set-buffer-file-coding-system (CTL-x RET f ISO-8859-1)
-> file-coding-system for the 'file-names' ?
To get UTF-8 to work, use xemacs-mule in a version >= 21.5.(28)
- (67)Change the directory where XEmacs stores its backup files
(require 'backup-dir)
(setq bkup-backup-directory-info '( (t "~/.xemacs_backups/") full-path prepend-name search-upward))
------ exemple -----
http://www.xemacs.org/Documentation/packages/html/edit-utils_12.html
Allows backup files to be optionally stored in some directories, based on the value of the alist, bkup-backup-directory-info. This variable is a list of lists of the form (FILE-REGEXP BACKUP-DIR OPTIONS ...). If the filename to be backed up matches FILE-REGEXP, or FILE-REGEXP is t, then BACKUP-DIR is used as the path for its backups. Directories may begin with "/" to specify an absolute pathname.
(require 'backup-dir)
(setq bkup-backup-directory-info
'(("/home/greg/.*" "/~/.backups/" ok-create full-path prepend-name)
("^/[^/:]+:" ".backups/") ; handle EFS files specially: don't
("^/[^/:]+:" "./") ; search-upward... its very slow
(t ".backups/"
full-path prepend-name search-upward)))
- (69)Mode to get functions/methods folding (reduction to one a "+" sign+ 1 line+"...")
Hide/Show method bodies in any programming environnement
use (ESC-x) hs-minor-mode
- (70)Narrow the working region
- to narrow: CTL-x n n
- to unnarrow: CTL-x n p
- (74)Move word by word
CTL-arrows
- (75)Swap letters or words or lines
- To swap letters, place the cursor on the second letter and use C-t
- To swap words, place the cursor on the first letter of the second word and use ESC-t
- To swap lines use C-x C-t
Note: bash uses similar key commands as emacs, thus this works in bash too :)
- (76)Change to upper/lower-case
- Select a region then press ESC-u to uppercase, ESC-l to lowercase, or ESC-c to capitalize (first letter to uppercase, remaining letters in lowercase)
Note: works with bash too ;)
- (84)Prefix a bunch of lines
- select a region
- type C-x string-rectangle or "C-x r t"
- type the cars you want to add a the beginning of the lines
- type "enter"
Very useful to comment a region in tex with %, in bash with # or in C++ with //
- (99)Get help
- C-h C-h then ? gives help on the help :)
- C-h b Table of all key bindings.
- C-h C-p Table of all mouse-button bindings.
- C-h a Type a substring; it shows a hypertext list of
functions and variables that contain that substring.
- C-h v Type a variable name; it displays its documentation and value.
- C-h c Type a command key sequence;
it displays the function name that sequence runs.
- C-h w Type a command name; it displays which keystrokes invoke that command.
- C-h l Recent input keystrokes and minibuffer messages.
- C-h C-h ? -> help on help
- C-h a -> a propos of a command
- C-h b -> list of all key bindings
- C-h c -> type key seq => show command
- C-h p -> mouse bondings
- C-h l -> recent keystrokes (last commands)
- C-h v -> Type a variable name; it displays its documentation and value.
- C-h w -> Type a command name; it displays which keystrokes invoke that command.
- (107)Select/Copy/Cut and history
- Mark start of selection with C-Space, then move
- Select all the buffer with C-x h
- Copy with ESC-w
- Cut with C-w
- Paste with C-y ('yank')
- If you cut something new, YOU DIDN'T loose the previous cut things. You can access them after yanking by using ESC-y to switch between alternatives
- (109)find function associated to a key-binding
C-x K
- (125)How to get (some parts of) the JDE completion to work?
Remember to add the 'jde.jar' to the classpath of the JDE mode
- (126)Work with java files
Use the JDE mode:
-> functions to generate templates called jde-gen-XXX
e.g.:
jde-gen-get-set for getters and setters
jde-gen-action-listener for action listener
jde-gen-class for a class
jde-gen-case
jde-gen-catch (GENERATES an EMPTY statement)
jde-gen-for
jde-gen-main
jde-gen-to-string-method
jde-gen-println
...
-> CTL-x CTL-v is the beginning of any command
e.g.:
CTL-c CTL-\ backslash-region
CTL-c CTL-c comment-region
CTL-x CTL-v . jde-complete-in-line
CTL-x CTL-v CTL- . jde-complete
CTL-c CTL-v t jde-gen-try-catch-wrapper (WRAPPER means some text is already written and it is wrapped in try-catch)
CTL-c CTL-v CTL-g jde-open-class-at-point (needs the selection of a class name to be opened)
C-c C-v C-l jde-gen-println
C-c C-v C-p save project
C-c C-v C-s open the list of files in the project
C-c C-v C-w help on symbol
C-c C-v C-x open supper class
C-c C-v C-z add import for class at point
C-c C-v C-n browse JDK doc
- (127)Rename a file/buffer
ESC-x rename-file
ESC-x rename-buffer
(even by doing the first then the second, it seems that C-x C-s still save under the old name of the file...)
- (128)Copy and cut a rectangular selection
- Select upper left corner (C-space)
- Select lower right corner (just position the cursor here)
- Cut with C-x C-r C-k (kill-rectangle)
- Paste with C-x C-r C-y (yank-rectangle)
- (132)Make UTF-8 work ;)
You need to install the 21.5 series, compiled with "./configure --with-mule"
- (133)Install all packages
1. Download the "sumo" files in the packages repository
2. To install the Sumo tarballs, simply unpack them to: /usr/local/lib/xemacs/
(from: http://www.xemacs.org/Install/index.html)
- (134)Frames
- make a new frame C-x 5f
- delete a frame C-x 50
- split the window, horizontally C-x 2
- switch to a split window C-x o
- make into one window C-x 1
(from http://burtleburtle.net/justine/Tech/xcomm.html)
- (135)Search and replace
- begin a search and replace ESC-%
- replace all occurrences at once !
- replace Space
- skip the replace n
- stop the search and replace ESC
- recursive edit (temporarily suspend, make edits) C-r
- continue with the search and replace ESC-C-c
- (167)What to do if Xemacs is VEEEEEEEEERY slow to open when the network is bad
This come from the fact that it tries to resolve some names calling "gethostbyname"
solution on the net 1 : they say to add "127.0.0.1 localhost" to /etc/hosts
Did not work
solution on the net 2 : to change order of name lookup to files THEN network in /etc/nsswitch.conf or /etc/host.conf
MY SOLUTION for openBSD : add these two lines to /etc/resolv.conf.tail:
lookup file bind
domain <mydomain>
- (168)Tip for insertion of text
C-u C-y inserts buffered text while keeping cursor where started the insertion instead of moving the cursor at the end of the insertion
- (169)Text jutification
set-justification-full/left/right/center
- (171)Quote a control sequence
CTL-v <key> in XTerm is similar to CTL-Q <key> in XEmacs: it prints (quotes) command received by the interpreter
- (176)How to bind keys correctly in the config file so that they work under xemacs -nw too
http://www.nongnu.org/emacs-tiny-tools/keybindings/index-body.html
- (196)file coding systems in Emacs
Emacs assigns a name to each coding system. Most coding systems are used for one language, and the name of the coding system starts with the language name. Some coding systems are used for several languages; their names usually start with `iso'. There are also special coding systems no-conversion, raw-text and emacs-mule which do not convert printing characters at all.
In addition to converting various representations of non-ASCII characters, a coding system can perform end-of-line conversion. Emacs handles three different conventions for how to separate lines in a file: newline, carriage-return linefeed, and just carriage-return.
C-h C coding RET
Describe coding system coding.
C-h C RET
Describe the coding systems currently in use.
M-x list-coding-systems
Display a list of all the supported coding systems.
- (214)How to make xemacs open file in only one instance?
- In .bashrc, add:
alias xemacs='~/.myxemacs'
- In .myxemacs paste (remember to set the execution bit):
#/bin/sh
gnuclient $@ || xemacs $@
- In .xemacs/init.el add:
(gnuserv-start)
- (269)My (structured) config file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GLOBAL BEHAVIOUR OF XEMACS ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Adds the place where new package are installed to load-path
(add-to-list 'load-path "~/.xemacs/addons/")
; Access Unicode files transparently
(require 'un-define)
; Prevent narrowing to a region? Why? Useful?
(put 'narrow-to-region 'disabled nil)
; Possible completions are printed in the mini-buffer
(require 'iswitchb)
(icomplete-mode)
;(load "icicles-xmas.el")
;(load "icicles-menu-xmas.el")
;(require 'icicles)
;(icy-mode 1)
; Live spelling correction
(flyspell-mode 1)
; Enabling the use of the mouse wheel
(autoload 'mwheel-install "mwheel" "Enable mouse wheel support.") ;
(mwheel-install)
(custom-set-variables
'(toolbar-visible-p nil)
'(line-number-mode t)
'(column-number-mode t)
'(paren-mode (quote sexp) nil (paren))
'(current-language-environment "Latin-1")
'(default-input-method "latin-1-prefix")
'(global-font-lock-mode t nil (font-lock))
'(kept-new-versions 10)
'(kept-old-versions 10)
'(pui-package-install-dest-dir "/usr/local/lib/xemacs/")
'(query-user-mail-address nil)
'(user-mail-address "liar@noaddress.org")
'(version-control t)
)
; A macro to comment a region whathever the current mode
(defun uncomment-region (beg end)
"Uncomment a region of text"
(interactive "r")
(comment-region beg end -1));
; Some useful key associations
(global-set-key [f4] (quote toggle-language))
(global-set-key [f5] (quote ispell-buffer))
(global-set-key [f6] (quote ispell-continue))
(global-set-key [f8] (quote mylatexmode))
(global-set-key [f9] (quote dabbrev-expand))
(global-set-key [f10] (quote compile))
(global-set-key [f11] (quote comment-region))
(global-set-key [f12] (quote uncomment-region))
; Default coding systems
;(set-file-coding-system 'no-conversion)
;(set-default-file-coding-system 'no-conversion)
;(setq file-coding-system 'no-conversion)
;;(add-hook 'latex-mode-hook 'set-buffer-file-coding-system 'no-conversion)
;;(add-hook 'tex-mode-hook 'set-buffer-file-coding-system 'no-conversion)
;;(add-hook 'text-mode-hook 'set-buffer-file-coding-system 'no-conversion)
;;(setq default-buffer-file-coding-system 'no-conversion)
;(set-coding-priority-list '(utf-8))
;(set-coding-category-system 'utf-8 'utf-8)
;;(set-buffer-file-coding-system 'utf-8)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; FONTS ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(custom-set-faces
'(default ((t (:size "13pt" :family "Fixed"))) t)
'(bold ((t (:size "14" :family "helvetica" :bold t))) t)
'(bold-italic ((t (:size "14" :family "helvetica" :bold t :italic t))) t)
'(font-latex-bold-face ((((class color) (background light)) (:foreground "DarkOliveGreen" :size "13" :bold t))))
'(font-latex-italic-face ((((class color) (background light)) (:foreground "DarkOliveGreen" :size "13" :italic t))))
'(italic ((nil (:family "helvetica" :bold nil :italic t))) t)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; EDIFF MODE ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(custom-set-variables
'(ediff-cmp-options nil)
'(ediff-diff-options "-a")
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GNUPLOT MODE ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(custom-set-variables
'(calc-gnuplot-name "/usr/local/bin/gnuplot" t)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; C SHARP MODE ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "csharp-mode.el")
(load "hide-show-csharp.el")
;(load "flymake.el")
;(load "flymake-for-csharp.el")
;(load "yasnippet-bundle.el")
;;(load "csharp/csde.el")
;;(load "/usr/local/lib/xemacs/xemacs-packages/lisp/vm/vm.el")
;;(load "/usr/local/lib/xemacs/xemacs-packages/lisp/gnus/mm-bodies.el")
;;(load "/usr/local/lib/xemacs/xemacs-packages/lisp/x-symbol/x-symbol.el")
(defun mycsharp ()
(require 'un-define)
; (set-coding-priority-list '(utf-8))
; (set-coding-category-system 'utf-8 'utf-8)
;; (require 'flymake-for-csharp)
;; (flymake-mode)
(hs-minor-mode 1)
(setq hs-isearch-open t)
(local-set-key "\C-c>" 'hs-hide-block)
(local-set-key "\C-c<" 'hs-show-block)
; (local-set-key "\C-w>" 'hs-hide-all)
; (local-set-key "\C-w<" 'hs-show-all)
)
(add-hook 'csharp-mode-hook 'mycsharp)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; TEXT MODE ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Allow accentuated characters
(defun myctextmode ()
(set-buffer-file-coding-system 'ctext)
)
(add-hook 'text-mode-hook 'myctextmode) ; no-conversion,raw-text,undecided,utf-8,iso-8859-1,ctext
(add-hook 'text-mode-hook 'turn-on-auto-fill) ; set automatic fill-mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; LATEX MODE ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'tex-site) ; make the LaTeX menu appear when loading .tex files
;(add-hook 'tex-mode-hook 'reftex-mode) ; loads references management tools
;(add-hook 'latex-mode-hook 'reftex-mode) ; loads references management tools
(add-hook 'tex-mode-hook 'turn-on-auto-fill) ; loads management of auto-fill
(add-hook 'latex-mode-hook 'turn-on-auto-fill) ; loads management of auto-fill
(add-to-list 'auto-mode-alist '("\\.tikz$" . LaTeX-mode)) ; adds the extension .tikz as a LaTeX mode extension
(custom-set-variables
'(LaTeX-eqnarray-label "Equation:") ; Changes some name for the ref tags
'(LaTeX-equation-label "Equation:")
'(LaTeX-figure-label "Figure:")
'(LaTeX-float "")
'(LaTeX-section-label (quote (("part" . "Part:") ("chapter" . "Chapter:") ("section" . "Section:") ("subsection" . "SSection:") ("subsubsection" . "SSSection:"))))
'(LaTeX-table-label "Table:")
'(TeX-PDF-mode t)
'(LaTeX-mode-hook (quote (reftex-mode)))
'(TeX-file-extensions (quote ("tex" "sty" "cls" "ltx" "texi" "texinfo" "dtx" "tikz"))) ; adds the extension .tikz as a LaTeX mode extension
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ASPELL MODE ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq-default ispell-program-name "aspell")
(setq current-language 1)
(ispell-change-dictionary "british")
(defun set-language-english ()
;Set english as ispell language
(setq current-language 1)
(ispell-change-dictionary "british")
(force-mode-line-update)
(setq sentence-end "[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*");
(setq sentence-end-double-space t)
)
(defun set-language-french ()
;Set french as ispell language
(setq current-language 0);
(ispell-change-dictionary "francais");
(force-mode-line-update);
(setq sentence-end "[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*");
(setq sentence-end-double-space t)
)
(defun toggle-language ()
"Toggle language between french/english"
(interactive)
(cond ((eq current-language 1)
(set-language-french))
((eq current-language 0)
(set-language-english))
(t (set-language-french))
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; MAKE BACKUPS IN A GLOBAL DIRECTORY ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'backup-dir)
(setq bkup-backup-directory-info '( (t "~/.xemacs_backup/" full-path prepend-name search-upward)))
(setq version-control 3)
(setq kept-new-versions 5)
(setq kept-old-versions 0)
- (273)Generating the "words" file (wordlist), to enable ispell-complete-word for aspell
0. List available dicts
aspell dump dicts
1. For each interesting dict, generate wordlist
aspell --lang <lang> dump master > words.<lang>
3. Concatenate all lists into one and move it to a central repository
cat words.* > words
mv words <centralized wordlist dir (ex: /usr/local/share/dict/)>
5. Tell (X)emacs where to find the wordlist file
(setq ispell-alternate-dictionary "/usr/local/share/dict/")
- (295)How to make Xemaces support UTF8 under OpenBSD?
export LANG="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_COLLATE="C"
export LC_TIME="C"
export LC_NUMERIC="C"
export LC_MONETARY="C"
export LC_MESSAGES="en_US.UTF-8"
export LC_ALL=""
AND
Change font to one that accepts accents (see .Xdefaults Xterm configuration)
Emacs.default.attributeFont: <use xfonsel to get one>
- (332)How to count # of cars?
M-=
- (383)Key bindings for ESS (mode for R)
From: http://ess.r-project.org/Manual/ess.html#Latest-version
C-h m
A complete list of keybindings that are available in each ESS mode
and brief description of that mode is available
M-x customize-group RET ess RET
A full list of them however is available by using the Custom
facility within emacs.
see http://ess.r-project.org/Manual/ess.html#Customization
- (402)How to generate a sequence?
C-u M-! seq 2 10
- (403)How to insert the result of a shell command?
C-u M-! echo "reversed" | rev
- (415)How to customize/configure ESS?
http://ess.r-project.org/Manual/ess.html#Customization
- (416)How to remove bad indentation of single '#' comments in ESS?
ESS -> Edit -> Fancy Comments = off
- (580)How to make backups in a global directory?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; MAKE BACKUPS IN A GLOBAL DIRECTORY ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'backup-dir)
(setq bkup-backup-directory-info '( (t "~/.xemacs_backup/" full-path prepend-name search-upward)))
(setq version-control 3) ; activate multi-backups
(setq kept-new-versions 5) ; number of most recent backups to save
(setq kept-old-versions 0) ; number of most older backups to save
(setq auto-save-interval 50) ; nb new cars between auto save
(setq auto-save-timeout 10) ; nb sec between auto save
(defun make-auto-save-file-name () ; changing dir of saves
"Return file name to use for auto-saves of current buffer..."
(if buffer-file-name
(concat
"~/.xemacs_backup/"
"#"
(file-name-nondirectory buffer-file-name)
"#")
(expand-file-name
(concat "#%" (buffer-name) "#"))))
- (581)How to open UTF-8 files in Xemacs?
If you want XEmacs to load UTF-8 files correctly, add the following lines to your ~/.xemacs/init.el:
(require 'un-define)
(set-coding-priority-list '(utf-8))
(set-coding-category-system 'utf-8 'utf-8)
From: http://www.maruko.ca/i18n/
- (777)How to remove welcome tab in emacs?
Add the following to your .emacs:
(setq inhibit-startup-message t)
- (782)Something like my ideal .emacs
(setq inhibit-startup-message t)
(global-set-key [C-tab] 'other-window)
; + parenthesis matching
; + CTRL-x b => buffer swap
; + CTRL-MAJ-up => bloc move
; - EOF in bash mode
(modify-coding-system-alist 'file "\\.txt\\'" 'utf-8)
; TO ADD: completion with Meta+/
; M-x check-parens
- (808)How to associate a file extension to an [X]emacs-mode?
(add-to-list 'auto-mode-alist '("\\.m$" . matlab-mode))
From: https://ccrma.stanford.edu/guides/planetccrma/Silly.html
- (880)How to make [X]Emacs copy/paste/yank buffers compatible with other applications?
X11 Copy & Paste to/from Emacs:
If you are having issues with cutting and pasting between emacs and other applications, it may be an issue with interactions between the UI’s clipboard or selection buffer and the emacs. Windows has a single clipboard buffer. X11 has more then one buffer. Consider these solutions:
XEmacs:
(setq interprogram-cut-function 'own-clipboard)
(setq interprogram-paste-function 'get-clipboard)
GNU Emacs 21.2.1 & newer:
(setq x-select-enable-clipboard t)
See also http://www.oreillynet.com/lpt/wlg/6162 which suggests
(setq x-select-enable-clipboard t) ; as above
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
GNU Emacs CVS / 23 :
This has recently been expanded with more possible customisations.
The following represents something extremely close in “feel” to other modern X11 desktop apps, but with “bonus” kill ring features. “feel”? that is to say, the precise key bindings are different to other X11 apps unless maybe you also turn on cua-mode, but the behaviour is very similar to C-x/C-c/C-v clipboard in other apps:
clipboard and primary X11 selections are kept separate, yet clipboard X11 selection and kill-ring are friends.
It is perhaps easier for some to learn that different keys doing similar things than the same keys doing different things, i.e. a newbie to emacs might analogise:
C-w ? Cut (really kill)
M-w ? Copy (really kill-ring-save)
C-y ? Paste (really yank)
M-y (after C-y) ? Historic Paste of old cuts/copies “bonus” (really yank-pop, that is to say the kill-ring cometh)
and with the following customizations, that analogy might actually work out okay:
; (transient-mark-mode 1) ; Now on by default: makes the region act quite like the text "highlight" in many apps.
; (setq shift-select-mode t) ; Now on by default: allows shifted cursor-keys to control the region.
(setq mouse-drag-copy-region nil) ; stops selection with a mouse being immediately injected to the kill ring
(setq x-select-enable-primary nil) ; stops killing/yanking interacting with primary X11 selection
(setq x-select-enable-clipboard t) ; makes killing/yanking interact with clipboard X11 selection
;; these will probably be already set to these values, leave them that way if so!
; (setf interprogram-cut-function 'x-select-text)
; (setf interprogram-paste-function 'x-cut-buffer-or-selection-value)
; You need an emacs with bug #902 fixed for this to work properly. It has now been fixed in CVS HEAD.
; it makes "highlight/middlebutton" style (X11 primary selection based) copy-paste work as expected
; if you're used to other modern apps (that is to say, the mere act of highlighting doesn't
; overwrite the clipboard or alter the kill ring, but you can paste in merely highlighted
; text with the mouse if you want to)
(setq select-active-regions t) ; active region sets primary X11 selection
(global-set-key [mouse-2] 'mouse-yank-primary) ; make mouse middle-click only paste from primary X11 selection, not clipboard and kill ring.
;; with this, doing an M-y will also affect the X11 clipboard, making emacs act as a sort of clipboard history, at
;; least of text you've pasted into it in the first place.
; (setq yank-pop-change-selection t) ; makes rotating the kill ring change the X11 clipboard.
Alternate method (recent Emacs):
Not sure when this appeared in GNU emacs, or if it’s how the developers intended things, buts it’s useful for me (I habitually use emacs from CVS, BTW, so not sure when this tip first applies): The “x-select-enable-clipboard t” method seems to resuscitate the “traditional” (and IMHO deeply strange) emacs interaction with the X11 primary and clipboard selections. EVERYTHING you highlight as a region winds up in both PRIMARY and CLIPBOARD X11 selections. That is… painful. (but N.B. no longer true in CVS emacs, which has x-select-enable-primary to manage primary behaviour separately as above).
But, some heroic emacs developer saw fit to produce the following functions, though they are by default bound to X keys I doubt many people have (actual keys called cut/copy/paste), so one can put the following in .emacs instead:
(global-set-key "\C-w" 'clipboard-kill-region)
(global-set-key "\M-w" 'clipboard-kill-ring-save)
(global-set-key "\C-y" 'clipboard-yank)
If you want to keep the C-w, M-w, and C-y original settings, there is another way is to bind these keys by using the default X11: – XinShi
(global-set-key [(shift delete)] 'clipboard-kill-region)
(global-set-key [(control insert)] 'clipboard-kill-ring-save)
(global-set-key [(shift insert)] 'clipboard-yank)
The emacs menu bar cut/copy/paste probably uses these too I think, but of course you’ve turned that off as you’ve been told that having the menu bar on will impede learning emacs. :-)
This produces behaviour I like: The current region becomes PRIMARY as one might expect (like most freedesktop.org compliant apps, so it can be directly middle-button pasted in X apps), but CLIPBOARD is NOT munged by merely highlighting a region (again like most freedesktop.org compliant apps, and unlike x-select-enable-clipboard) - Iff you kill and yank, it interacts with the X CLIPBOARD in a vaguely sane manner (as if C-w/M-w/C-y were like C-x/C-c/C-v in other X11 apps, roughly). This makes interacting with other X11 applications pleasant I think - you just learn that emacs uses different keys for cut/copy/paste, basically - though of course this behaviour might cause people to think the kill ring was a mere clipboard, which it isn’t, as a press of M-y after a few kills will readily demonstrate :-).
clipboard-yank in particular seems eerily smart.
From: http://www.emacswiki.org/emacs/CopyAndPaste
- (57)Convert file from/to encoding (utf8, iso8859-1...)
iconv -f utf8 -t iso8859-1
(-f = from, -t = to)
- (22)The RAID levels
2.4 The RAID levels
Here's a short description of what is supported in the Linux RAID
patches. Some of this information is absolutely basic RAID info, but
I've added a few notices about what's special in the Linux
implementation of the levels. Just skip this section if you know RAID.
The current RAID patches for Linux supports the following levels:
* Linear mode
o Two or more disks are combined into one physical
device. The disks are ``appended'' to each other, so writing
linearly to the RAID device will fill up disk 0 first, then
disk 1 and so on. The disks does not have to be of the same
size. In fact, size doesn't matter at all here :)
o There is no redundancy in this level. If one disk crashes
you will most probably lose all your data. You can however
be lucky to recover some data, since the filesystem will
just be missing one large consecutive chunk of data.
o The read and write performance will not increase for
single reads/writes. But if several users use the device,
you may be lucky that one user effectively is using the
first disk, and the other user is accessing files which
happen to reside on the second disk. If that happens, you
will see a performance gain.
* RAID-0
o Also called ``stripe'' mode. The devices should (but need
not) have the same size. Operations on the array will be
split on the devices; for example, a large write could be
split up as 4 kB to disk 0, 4 kB to disk 1, 4 kB to disk 2,
then 4 kB to disk 0 again, and so on. If one device is much
larger than the other devices, that extra space is still
utilized in the RAID device, but you will be accessing this
larger disk alone, during writes in the high end of your
RAID device. This of course hurts performance.
o Like linear, there is no redundancy in this level
either. Unlike linear mode, you will not be able to rescue
any data if a drive fails. If you remove a drive from a
RAID-0 set, the RAID device will not just miss one
consecutive block of data, it will be filled with small
holes all over the device. e2fsck or other filesystem
recovery tools will probably not be able to recover much
from such a device.
o The read and write performance will increase, because
reads and writes are done in parallel on the devices. This
is usually the main reason for running RAID-0. If the busses
to the disks are fast enough, you can get very close to N*P
MB/sec.
* RAID-1
o This is the first mode which actually has
redundancy. RAID-1 can be used on two or more disks with
zero or more spare-disks. This mode maintains an exact
mirror of the information on one disk on the other
disk(s). Of Course, the disks must be of equal size. If one
disk is larger than another, your RAID device will be the
size of the smallest disk.
o If up to N-1 disks are removed (or crashes), all data are
still intact. If there are spare disks available, and if the
system (eg. SCSI drivers or IDE chipset etc.) survived the
crash, reconstruction of the mirror will immediately begin
on one of the spare disks, after detection of the drive
fault.
o Write performance is often worse than on a single device,
because identical copies of the data written must be sent to
every disk in the array. With large RAID-1 arrays this can
be a real problem, as you may saturate the PCI bus with
these extra copies. This is in fact one of the very few
places where Hardware RAID solutions can have an edge over
Software solutions - if you use a hardware RAID card, the
extra write copies of the data will not have to go over the
PCI bus, since it is the RAID controller that will generate
the extra copy. Read performance is good, especially if you
have multiple readers or seek-intensive workloads. The RAID
code employs a rather good read-balancing algorithm, that
will simply let the disk whose heads are closest to the
wanted disk position perform the read operation. Since seek
operations are relatively expensive on modern disks (a seek
time of 6 ms equals a read of 123 kB at 20 MB/sec), picking
the disk that will have the shortest seek time does actually
give a noticeable performance improvement.
* RAID-4
o This RAID level is not used very often. It can be used on
three or more disks. Instead of completely mirroring the
information, it keeps parity information on one drive, and
writes data to the other disks in a RAID-0 like way. Because
one disk is reserved for parity information, the size of the
array will be (N-1)*S, where S is the size of the smallest
drive in the array. As in RAID-1, the disks should either be
of equal size, or you will just have to accept that the S in
the (N-1)*S formula above will be the size of the smallest
drive in the array.
o If one drive fails, the parity information can be used to
reconstruct all data. If two drives fail, all data is lost.
o The reason this level is not more frequently used, is
because the parity information is kept on one drive. This
information must be updated every time one of the other
disks are written to. Thus, the parity disk will become a
bottleneck, if it is not a lot faster than the other
disks. However, if you just happen to have a lot of slow
disks and a very fast one, this RAID level can be very
useful.
* RAID-5
o This is perhaps the most useful RAID mode when one wishes
to combine a larger number of physical disks, and still
maintain some redundancy. RAID-5 can be used on three or
more disks, with zero or more spare-disks. The resulting
RAID-5 device size will be (N-1)*S, just like RAID-4. The
big difference between RAID-5 and -4 is, that the parity
information is distributed evenly among the participating
drives, avoiding the bottleneck problem in RAID-4.
o If one of the disks fail, all data are still intact,
thanks to the parity information. If spare disks are
available, reconstruction will begin immediately after the
device failure. If two disks fail simultaneously, all data
are lost. RAID-5 can survive one disk failure, but not two
or more.
o Both read and write performance usually increase, but can
be hard to predict how much. Reads are similar to RAID-0
reads, writes can be either rather expensive (requiring
read-in prior to write, in order to be able to calculate the
correct parity information), or similar to RAID-1
writes. The write efficiency depends heavily on the amount
of memory in the machine, and the usage pattern of the
array. Heavily scattered writes are bound to be more
expensive.
- (30)Kill defunct processes
Defunct process also known as "zombie" process are the ones that for
some reason lose the handle to the parent, or the parent loses the
handle to the child process, so the last step of clean up does not
occur when the process finishes.
Here is the favorite technical quote of Zombie processes: "When a
process dies, it becomes a zombie process. Normally, the parent
performs a wait() and cleans up the PID. Sometimes, the parent
receives too many SIGCHLD signals at once, but can only handle one at
a time. It is possible to resend the signal on behalf of the child via
kill -18 PPID. Killing the parent or rebooting will also clean up
zombies. The correct answer is to fix the buggy parent code that
failed to perform the wait() properly."
Usually keeping the OS and the application up to par with regards to
patches should take care of the problem, however, once in a while
you'll have this. It is not terribly important to clean these up, as
they are inactive and generally harmless.
- (31)Firewalling / iptables / Setting /proc Values
Currently, linux uses files in /proc to store certain
settings. Placing a "1" in a file called /proc/sys/net/ipv4/ip_forward
for example, will turn on ip forwarding, which you will need to create
your gateway. For both 2.2 and 2.4 series kernels, here is a small
script that will set all the appropriate values in /proc (partially
taken from page 3 of the IP Masquerade HOWTO).
#!/bin/sh
#
# rc.firewall_proc_config - Sets various /proc values needed
# to create a firewall/gateway.
#CRITICAL: Enable IP forwarding since it is disabled by default since
#
# Redhat Users: you may try changing the options in
# /etc/sysconfig/network from:
#
# FORWARD_IPV4=false
# to
# FORWARD_IPV4=true
#
echo "1" > /proc/sys/net/ipv4/ip_forward
#CRITICAL: Enable automatic IP defragmenting since it is disabled by default
# in 2.2.x kernels. This used to be a compile-time option but the
# behavior was changed in 2.2.12
#
echo "1" > /proc/sys/net/ipv4/ip_always_defrag
# Dynamic IP users:
#
# If you get your IP address dynamically from SLIP, PPP, or DHCP, enable this
# following option. This enables dynamic-ip address hacking in IP MASQ,
# making the life with Diald and similar programs much easier.
#
#echo "1" > /proc/sys/net/ipv4/ip_dynaddr
#SECURITY-CRITICAL:
#
# Use "SYN Cookies" cryptographic challenge to help prevent
# SYN-Flood DOS Attacks
#
echo 1 >/proc/sys/net/ipv4/tcp_syncookies # Helps Prevent SYN-Flood DOS Attacks
#SECURITY-CRITICAL:
#
# Enable Route Verification on all interfaces to help prevent IP Spoofing.
# Route verification is where a packet which comes from an unexpected
# interface is dropped. If you have Asymmetric Routing, you will instead
# want to disable this filtering on those interfaces.
#
for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
echo 1 > $f
done
- (32)My first helpfile under linux :)
---- aide / tutorials ----
man -k/-K : apropos/recherche dans les pages man
man awk : Aide sur les Expressions régulières
man -t <cmde>: sort le .ps sur stdout du man de la commande
---- commandes diverses ----
ulimit -c 0 : pas de core dump
nice : priorités
time : diverse mesures de temps d'exécution d'un programme
nohup : arrière plan
strace : trace l'execution d'un prog => affiche les libs qui merdent
xargs : echo "coucou" | xargs cat => passe "coucou" comme argument à cat
script : enregistre stdin stderr stdout dans un fichier, finir avec exit.
---- réseau ----
last : dernières personnes logguées
netstat : connexions courrantes
chroot : déplace le /
hdparm : régler les paramètres UDMA du disque
lpstat : liste des imprimantes
---- X ----
xdpyinfo : pour avoir toutes les infos sur la config de X
xev : keycode clavier et souris
xrdb : reload config X (utiliser -load ou -all)
XvGetPortAttribute(dpy, port, attribute, p_value) : pour choisir la luminosité et le contraste
xvinfo : toutes les infos sur l'extension Xv de Xfree
---- programmation ----
hexdump <file> : affiche un file en hexa
make kernel : make clean ; make xconfig ; make dep ; make ; make modules ; make install ; make modules_install
depmod : recrée la liste des dépendances de modules du kernel actuel
java -Xms<val>M : une pile de <valeur> Méga AU DEPART au lieu de 32 M
java -Xmx<val>M : une pile de <valeur> Méga MAX au lieu de 32 M
basename : pour virer une extention à un nom de fichier
---- Xterm ----
--config--
stty : -a pour voir toutes les option, voir man pour les réglages
xterm -sl num -fn <font> : pour régler la taille de fontes de xterm
xterm bloqué : reset / tput reset / tput init / C-j reset C-j / stty sane / C-v C-o ret
--fontes--
kbd : charge la police console
xmodmap -pke : affiche la table d'association touche/action actuelle
--locale--
zoneinfo : charge les parametre locaux pour l'horloge
--calculs--
echo "scale=5; 13.0/24.0" | bc
---- Progs ----
xemacs : CTL-x ESC-ESC? : rappel de la dernière commande (utile après un combi de touches !)
: Pour mettre les modes en route modifier /usr/local/lib/xemacs-21.1.14/lisp/auto-autoloads.el
en retirant (<=>; devant) les lignes contenant "Already Loaded" puis recompiler en .elc par xemacs
xfig : pour avoir les caractères spéciaux (alpha ...) il faut changer de Fonte (Symbol)
--------------------------
PROTOCOLES DE TRANSFERT :
kermit recevoir et transmettre: protocol kermit kermit -h
sb transmettre: protocol y-modem sz -h
sx transmettre: protocol x-modem sz -h
sz transmettre: protocol z-modem sz -h
rb recevoir: protocol y-modem rz -h
rx recevoir: protocol x-modem rz -h
rz recevoir: protocol z-modem rz -h
--------------------------
FICHIERS :
/etc/hosts : config du nom de machine
/etc/resolv.conf : DNS
/etc/ppp/pap-secret et
/etc/ppp/peers/adsl : config des login/mdp pour ADSL
/etc/fstab : pour les droits users : user,gid=XX,uid=YY
/etc/inittab : config des niveaux de boot
/etc/printcap : config imprimante
/etc/services : liste des port associé
/etc/inetd.conf : limitations des services
/etc/host : nom de machine
/etc/hosts.XXX : limitation imprimante
/home/<xxx>/.xsession : pour lancer des trucs à chq démarrage de session X
--------------------------
Comment mettre un LinuX sur un réseau :
0. charger les iptables pour la sécurité
1. régler les services dans /etc/inetd.conf et /etc/services
2. régler les DNS dans /etc/resolv.conf
3. changer le nom de machine : /etc/host ou hostname <nom de machine>
4. lancer l'interface : ifconfig eth0 up 192.168.1.<xxx> netmask 255.255.255.0
3. route par défaut : route del default ; route add -host 192.168.1.<yyy> dev eth0 gw 192.168.1.<yyy>
--------------------------
Comment mettre un DD SCSI sous LinuX :
1. Vérifier le SCSI ID sur le DD avec le Jumper
2. Vérifier au boot que le kernel voit le DD (dmesg) et quel /dev lui est lié
3. Partitionner le DD (fdisk /dev/sd<x> où <x> à remplacer par la lettre donnée en 2)
Mettre le partitions en ext2fs = 83
4. Formatter les partitions (mke2fs /dev/sd<x><y> <x> est une lettre, <y> un chiffre)
5. Créer le répertoire où monter le disque (mkdir /mnt/disk<y>)
6. Ajouter une ligne dans /etc/fstab du type : /dev/sd<x><y> /mnt/disk<y> ext2 defaults 0 0
- (36)Raising skinny elephants is utterly boring (SysReq Keys, thanks to Infernal Quack, Aurélien Bompard and Pierre Tramo)
Si vous bidouillez un peu trop votre Linux et qu'à un moment il
"freeze" et que même CTRL-ALT-SUPPR ne le ranime pas, n'appuyez
surtout pas le bouton reset de votre ordi car ça implique un fsck au
prochain démarrage. Essayer d'abord les contrôles systèmes dans
l'ordre suivant : Alt-SysRq-S (met le swap sur disque) Alt-SysRq-U
(remonte tout en readonly) Alt-SysRq-B (reboot) Et adieu le check
forced :)
Plus d'infos dans /usr/src/linux/Documentation/sysrq.txt
http://linuxfr.org/tips/23.html
-----------------
En fait, la serie est un peu plus longue. C'est :
R S E I U B
R passe ton clavier en mode RAW, après tu peux réessayer C-A-Del ou
mieux C-A-BackSpace (tue X).
E je sais plus ;)
I non plus ;)
U remonte des systèmes de fichier en mode Read-only
Il y a une phrase (à la con) pour se souvenir de tout :
Raising Skinny Elephants Is Utterly Boring.
J'avais aussi trouvé quelquepart :
"Remembering the Sequence Entirely Is Useful, Buddy"
mais je préfère l'autre. ;)
---------------------
d'après sysrq.txt:
* What are the 'command' keys?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'r' - Turns off keyboard raw mode and sets it to XLATE.
'k' - Secure Access Key (SAK) Kills all programs on the current
virtual console. NOTE: See important comments below in SAK
section.
'b' - Will immediately reboot the system without syncing or
unmounting your disks.
'o' - Will shut your system off (if configured and supported).
's' - Will attempt to sync all mounted filesystems.
'u' - Will attempt to remount all mounted filesystems read-only.
'p' - Will dump the current registers and flags to your console.
't' - Will dump a list of current tasks and their information to your
console.
'm' - Will dump current memory info to your console.
'0'-'9' - Sets the console log level, controlling which kernel
messages will be printed to your console. ('0', for example
would make it so that only emergency messages like PANICs or
OOPSes would make it to your console.)
'e' - Send a SIGTERM to all processes, except for init.
'i' - Send a SIGKILL to all processes, except for init.
'l' - Send a SIGKILL to all processes, INCLUDING init. (Your
system will be non-functional after this.)
'h' - Will display help ( actually any other key than those
listed above will display help. but 'h' is easy to remember :-)
pour pouvoir utiliser ces combinaisons, il faut les avoir
compilés leurs support dans le noyau (kernel hacking/Magic Sysrq
key) il est possible de les désactiver grâce à un simple:
echo "0" > /proc/sys/kernel/sysrq
mais la meilleure des choses reste de lire la doc du noyau pour
en savoir plus.
------
Other typical sentences to remember the sequence:
"Raising Elephants Is So Utterly Boring"
"Raising Skinny Elephants Is Utterly Boring"
"Reboot Even If System Utterly Broken"
"BUSIER" read backward
"Red Stripe Ends In Unique Blends"
"Rebooting So Easy In Ubuntu Breezy"
"Remembering the Sequence Entirely Is Useful, Buddy"
- (68)Undelete files
-> Umount the filesystem
-> Use mc (Midnight Commander): "Commands" -> "Undelete Files"
- (88)A simple "Trash Can" script to replace rm by a mv to a Trash dir to prevent f*ck*ng "rm -fr /*"-like mistakes
------------------------------- /bin/myrm
#!/usr/local/bin/bash
# to use this script to prevent fucking "rm -fr /*"-like mistakes:
# 1. call this script "myrm", put it in /bin and make it executable
# 2. create an alias for each user that wants to use it: alias rm='/bin/myrm' >> ~<user>/.bash_profile
# 3. Don't forget to empty the trash for time to time (or make a script that does it)
trashLocation="/tmp/Trash" # MUST be an ABOSLUTE path
if [[ ! -d ${trashLocation} ]]
then
mkdir ${trashLocation} >/dev/null 2>&1
fi
for i in "$@"
do
#ls "${trashLocation}/"
result=`/bin/mv "$i" "${trashLocation}/"`
echo -n "Moving '$i' to the trash: "
if [[ result -eq 0 ]]
then
echo "OK"
else
echo "ERROR"
fi
done
- (115)Copy a whole directory from linux to linux through FAT32 file system without loosing ownership and case
It's simple: build a tar/targz archive ;)
- (121)Preserve permissions and owners when moving files on FAT filesystem
Simply build a tar/targz archive
- (147)When multiple booting the clock does not show the same time under all the OSes
Set the Hardware Clock to UTC
By default, OpenBSD assumes your hardware clock set to UTC (Universal Coordinated Time) rather than local time, assumed by some other operating systems, which can cause problems when multi-booting.
Many other operating systems, can be configured to do the same, which avoids this problem altogether.
If having the hardware clock set to UTC is a problem, you can change the default behavior of OpenBSD using config(8). For example, to configure OpenBSD to use a hardware clock set to US/Eastern (5 hours behind UTC, so 300 minutes):
# config -ef /bsd
OpenBSD 4.6 (GENERIC.MP) #89: Thu Jul 9 21:32:39 MDT 2009
deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
Enter 'help' for information
ukc> timezone 300
timezone = 300, dst = 0
ukc> quit
Saving modified kernel.
See options(4) and search for option "TIMEZONE=value" for more information.
Normally, the time zone is set during install. If you have need to change the time zone, you can create a new symbolic link to the appropriate time zone file in /usr/share/zoneinfo. For example, to set the machine to use EST5EDT as the new local time zone:
# ln -fs /usr/share/zoneinfo/EST5EDT /etc/localtime
From:
http://www.openbsd.org/faq/faq8.html
http://ubuntuforums.org/archive/index.php/t-43810.html
- (170)How to get the UUID of a drive
ls -l /dev/disk/by-uuid/
blkid /dev/sda1
sudo vol_id /dev/sda1
UUID=4020BFEC20BFE6D6 /media/Windows ntfs defaults 0 0
- (180)How to make an archive (e.g. tar) whithout forgetting '.*' files and without "going up" in the directory structure (because of following ../)
find . | xargs tar cvf <name>.tar
find . > /tmp/list
tar xvf <name>.tar -T /tmp/list
- (186)How to switch off the bell
$ setterm -blength 0
$ xset b off
$ xset b on
- (229)Install Word 2003 in wine in TinyCore 2.10
To install :
- Set gdiplus + riched20 + riched32 to native
After installation :
- Word will say that something is not installed correctly
=> rm .wine/drive_c/windows/Installer/*
- Word still says that something has to be repaired
=> ???
- (247)List of sites to find FOSS alternatives
http://www.alternative.to/
http://www.osalt.com/
- (250)How to recover from icons problems in evolution or any other Gtk -based application?
$ chmod -R 0775 /usr/share/icons
$ echo gtk-icon-theme-name=\"gnome\" >> ~/.gtkrc-2.0
- (334)What is the meaning of the section numbers for the manual pages?
The section numbers group the topics into several categories, but three
are of primary interest: user commands are in section 1, file formats
are in section 5, and administrative information is in section 8.
- (341)How to force a user to change her login at next login?
Il te suffit d'effectuer la commande:
#passwd -e username
en remplacant username par le nom d'utilisateur.
Cordialement.
Le 26 mars 2011 00:08, Jrmmmme Desquilbet <jerome@desquilbet.org> a crit :
> > Bonsoir,
> > Je pose la question aprs avoir cherché en vain dans les pages man...
> > Comment fait-on pour obliger un utilisateur à changer son mot de passe à son
> > prochain login
- (355)How to limit a process (e.g. these f*ck*ng memory-leaking FF4&FF5) memory consumption?
ulimit -d 524288 # (512Mo)
- (356)How to change a user's default shell without beeing root and editing /etc/password?
chsh -s /path/to/shell {user-name}
chsh changes the user login shell. This determines the name of the user's initial login command. A normal user may only change the login shell for her own account, the super user may change the login shell for any account.
http://www.cyberciti.biz/faq/howto-set-bash-as-your-default-shell/
- (358)How to make/use an encrypted filesystem under linux with cryptsetup, using a crypted file as partition?
# create file for cryptedFS
head -c <size> /dev/<zero or random> > luksfile # create empty file
losetup /dev/loop0 luksfile # map luksfile to /dev/loop0
cryptsetup luksFormat /dev/<loop device> -c aes -s 256 -h sha256 # create LUKS on loop device
cryptsetup luksOpen /dev/<loopdevice> <name> # map the loop device to a /dev/maaper device
mke2fs -j /dev/mapper/<name> -L <description string> # initialize a file system
# mount cryptedFS
losetup /dev/loop0 luksfile # map luksfile to /dev/loop0
cryptsetup luksOpen /dev/<loopdevice> <name> # map the loop device to a /dev/maaper device
mount /dev/mapper/<name> /mnt/<mountpoint> # mounts the encrypted file
# umount everything
umount /mnt/<mountpoint>
cryptsetup luksClose /dev/<loopdevice>
losetup -d /dev/<loopdevice>
- (359)How to make an encrypted filesystem under linux with cryptsetup, using directly a partition?
# create file for cryptedFS
cryptsetup luksFormat /dev/<partition> -c aes -s 256 -h sha256 # create LUKS on loop device
cryptsetup luksOpen /dev/<partition> <name> # map the loop device to a /dev/maaper device
mke2fs -j /dev/mapper/<name> -L <description string> # initialize a file system
# mount cryptedFS
cryptsetup luksOpen /dev/<partition> <name> # map the loop device to a /dev/maaper device
mount /dev/mapper/<name> /mnt/<mountpoint> # mounts the encrypted file
# umount everything
umount /mnt/<mountpoint>
cryptsetup luksClose /dev/<partition>
- (368)Where does nautilus mount the samba/cifs shares?
in ~.gvfs/
(note: the f**king latest versions of "mount -t cifs/smbfs" does allow only root to mount such shares. However, at boot, when the computer runs is root, there is no access to the network, since it is WICD as a user that makes it work and when I have access to the network, I am logged in as a single user... therefore I cannot use a simple script at boot to mount the shares...)
- (380)Linux Mint 11 configurations
E:Malformed line 1 in source list /etc/apt/sources.list.d/local-repository.list (dist parse)
> slash ( / ) is what is the solution. just add ( katya/ ) instead of ( katya ) in /etc/apt/sources.list.d/local-repository.list file
__________________________________________________
error "request_module: runaway loop modprobe binfmt-464c"
Short answer: If you are getting this error right after linux kernel initialization, you are likely booting a 32-bit kernel with a 64-bit OS
http://saalwaechter-notes.blogspot.com/2008/10/requestmodule-runaway-loop-modprobe.html
_________________________________________________
W:Failed to fetch http://archive.canonical.com/ubuntu/dists/katya/partner/binary-amd64/Packages 404 Not Found
refresh servers lists
_________________________________________________
Set the clock to UTC (so that it does not conflicts with OpenBSD)
gksu gedit /etc/default/rcS => UTC="yes"
- (384)What to do if errors saying that dbus is not running occur?
When getting a DBus error or when launching a software that does nothing but should talk with devices.other programs
use:
$ dbus-launch <name of software>
- (387)Useful flags for pgrep
-f The pattern is normally only matched against the process name. When -f is set, the full command line is used.
-u euid,...
Only match processes whose effective user ID is listed. Either the numerical or symbolical value may be used.
-x Only match processes whose name (or command line if -f is specified) exactly match the pattern.
- (392)Script to umount a luksFS encrypted file
umount /dev/mapper/airpx # unmounts the encrypted file
cryptsetup luksClose /dev/mapper/airpx # unmap the loop device to a /dev/maaper device
losetup -d /dev/loop0 # detaches the crypted file
- (393)How to take a screenshot in commandline mode (a.k.a import/scrot)?
http://tips.webdesign10.com/how-to-take-a-screenshot-on-ubuntu-linux
How to Take a Screenshot in Linux With the Terminal (ImageMagick)
My favorite way of taking screenshots is with ImageMagick in the terminal. If you need a delay before taking the screenshot (for example, to get a screenshot of a menu that would disappear if you took a screenshot with GNOME) ImageMagick is the best way.
First, make sure you have ImageMagic installed: type import -version in the terminal. If ImageMagick is installed, you will see the ImageMagick version number. I don't think Ubuntu comes with ImageMagick. To install ImageMagick in Ubuntu (or any Debian-based distro), just type sudo apt-get install imagemagick.
To take a screenshot in the terminal with ImageMagick, type the following line into a terminal and then click-and-drag the mouse over a section of the screen:
import MyScreenshot.png
GNOME will beep once when the screenshot begins, and once again when the screenshot is complete. Then type eog MyScreenshot.png in the terminal to view your screenshot. "eog" is the command to start Eye of GNOME.
To capture the entire screen after a delay (so you can open some menus or whatever), type sleep 10; import -window root MyScreenshot2.png. The first part of that line, sleep 10; will give you a 10 second delay before the screenshot begins. The next part, import -window root, tells ImageMagick to import the "root" window \u2014 that is, the entire screen. The last part MyScreenshot2.png is the name of your screenshot.
Another example of taking a screenshot in Linux with the terminal
The following command will wait for 15 seconds, take a screenshot, and then open the screenshot in the GIMP for editing:
sleep 15; import -window root MyScreenshot3.png; gimp MyScreenshot3.png;
You can also manipulate the screenshot with ImageMagick as you take it. For example, the following line will take a screenshot and resize the image to a width of 500 pixels:
import -window root -resize 500 AnotherScreenshot.png
For more information on how to take screenshots in the terminal with ImageMagick, type man imagemagick in the terminal. You can also type import -help to get a list of options for the import command.
How to Take a Screenshot in Linux With the Terminal (scrot)
Another way to take a screenshot from the terminal is with scrot. I learned about this at UbuntuForums.org.
To install scrot (on Ubuntu) type:
sudo aptitude install scrot
To take a screenshot in Linux from the terminal with scrot type:
scrot MyScreenshot.png
To get a screenshot and immediately open it in the GIMP, type:
scrot -q 85 -d 5 screenshot.png && gimp screenshot.png &
The -q option sets the quality. The -d sets the delay. The && means that if the first command is true, then execute the second. The final & means to run the commands in the background so that you can still use that terminal for other commands.
For more information about using scrot, read the man pages by typing the following in the terminal:
man scrot
How to Take a Screenshot in Linux With the Terminal (gnome-panel-screenshot)
As described in my newer Linux screenshot tutorial, you can also take a screenshot from the Linux terminal in GNOME with the following command:
gnome-panel-screenshot
You can also add a delay:
gnome-panel-screenshot --delay 5
- (409)How to remove fortunes in LinuxMint11?
in gconf-editor set this entry
/desktop/linuxmint/terminal/show_fortunes
to false
(there is also an entry in gnome-control-center under "window manager"/"terminal" or something like that...)
- (470)How to detect which linux distro is running?
"uname -r" for kernel.
"cat /etc/issue" for distro (on any distro)
--
Novell SUSE /etc/SUSE-release
Red Hat /etc/redhat-release, /etc/redhat_version
Fedora /etc/fedora-release
Slackware /etc/slackware-release, /etc/slackware-version
Debian /etc/debian_release, /etc/debian_version,
Mandrake /etc/mandrake-release
Yellow dog /etc/yellowdog-release
Sun JDS /etc/sun-release
Solaris/Sparc /etc/release
Gentoo /etc/gentoo-release
UnitedLinux /etc/UnitedLinux-release
ubuntu /etc/lsb-release
From: http://www.novell.com/coolsolutions/feature/11251.html
- (490)A simple script to take snapshots of pre-defined webpages
#!/bin/sh
# From: http://stackoverflow.com/questions/125951/command-line-program-to-create-website-screenshots-on-linux
# start a server with a specific DISPLAY
vncserver :11 -geometry 1024x768
# start firefox in this vnc session
firefox -display :11
# read URLs from a data file in a loop
count=1
while read url
do
# send URL to the firefox session
firefox -display :11 $url
# take a picture after waiting a bit for the load to finish
sleep 5
import -window root image$count.jpg
done < url_list.txt
# clean up when done
vncserver -kill :11
- (491)How to clear/reset any terminal?
tput [-Ttype] capname [parms ... ]
tput [-Ttype] init
tput [-Ttype] reset
tput [-Ttype] longname
tput -S <<
tput -V
tput clear
Echo the clear-screen sequence for the current terminal.
- (502)How to re-install grub?
# grub-install /dev/XXX
- (538)How to back-up files while preserving permissions?
DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
- 7-zip does not store the owner/group of the file.
On Linux/Unix, in order to backup directories you must use tar :
- to backup a directory : tar cf - directory | 7za a -si directory.tar.7z
- to restore your backup : 7za x -so directory.tar.7z | tar xf -
- (554)Bitlbee: How to create a room to speak to one buddy in particular?
Use:
/query <nickname>
Instead of:
/msg <nickname> <message>
<nickname>: <message>
- (565)How to make a user a sudoer on Ubuntu?
# usermod -a -G admin gmuller
- (567)How to prevent overwriting of existing files?
Use the 'k' option:
tar xkvzf file.tgz
Useful when mistaking x for c... => does not overwrite existing files!
- (569)How to set default browser (or any alternative software) in Mint/Ubuntu?
check the output of the following commands and how they could be changed
- exo-open http://<somesite>
- xdg-open http://<somesite>
- gnome-open http://<somesite>
- kde-open http://<somesite>
- (pcmanfm http://<somesite>)
$ update-alternatives --list x-www-browser
/usr/bin/arora
/usr/bin/firefox
/usr/bin/konqueror
/usr/bin/midori
# update-alternatives --set x-www-browser /usr/bin/firefox
- (570)How to store alsa mixer configuration?
1. set mixer levels using (as user or root?):
$ alsamixer
2. save configuration (as root) using:
# alsactl store
- (571)How to see the progress of a command (e.g. the growth of resulting file)?
watch -n <refresh delay in secs> "<command>"
e.g.,
$ watch -n 1 "ls -al outfile.text"
- (574)How to follow the execution of a command?
Use 'pv' to watch the throughput of a command:
cat backup.iso | pv -b | nc -l 3333
From: http://www.g-loaded.eu/2006/11/06/netcat-a-couple-of-useful-examples/
- (576)How to know which distribution of Linux you are running?
$ cat /etc/issue
$ cat /etc/issue.net
$ lsb_release -a
$ cat /etc/*-release
$ cat /etc/*-version
$ cat /etc/*release
$ cat /etc/*_release
$ cat /etc/*version
- (579)My .Xsession
# A function that runs a process only if it is not already running
# This version allow to run programs with arguments :)
function run_only_once()
{
IFS=" " read -a splitted <<< $1
pgrep -u `id -u` -x `basename ${splitted[0]}` || eval ${splitted[*]}
}
# Swap CTL and CapsLock keys
# Set correct FR keymap (i.e. with numpad)
(sleep 0 ; source /home/gmuller/Softs/set_keyboard) &
# Run screensaver deamon
(sleep 1 ; run_only_once "/usr/bin/xscreensaver -no-splash" ) &
# Run davmail, the proxy to get LDAP+MAIL+CALENDAR from the Outlook/Exchange server
(sleep 1 ; run_only_once "/usr/bin/davmail" ) &
# Set sound level
(sleep 1 ; /usr/bin/amixer sset 'Master' 98% ; /usr/bin/amixer sset 'Headphone' 98% ; /usr/bin/amixer sset 'Speaker' 98% ; /usr/bin/amixer sset 'PCM' 98%) & # /usr/bin/amixer sset 'Beep' disable
# Run MintUpdate
(sleep 1 ; run_only_once "/usr/lib/linuxmint/mintUpdate/mintUpdate.py" ) &
# Run network applet
(sleep 1 ; run_only_once "/usr/bin/nm-applet" ) &
# Run ACPI applet
(sleep 1 ; run_only_once "/usr/bin/gnome-power-manager" ) &
# Set correct resolution on both screens (particularly the right one)
(sleep 2 ; source /home/gmuller/Softs/set_resolution) &
# Set bg image
(sleep 3 ; source /home/gmuller/Softs/set_background) &
# Set the ssh-agent so that the passphrase is to be entered only one in this X session
(/usr/bin/ssh-agent /usr/bin/awesome & /usr/bin/ssh-add) &
- (597)How to kill a zombie?
Tuesday, May 13, 2008
Killing Zombie Processes In Linux And Unix
Greetings,
Today's post is going to deal with "zombie" processes. These are processes to which the definition of a process only loosely applies.
A zombie process is most often generated when a parent process loses track of its child process and that child process becomes detached. The parent process, generally running some sort of a "wait()" call to receive notification that the child process has exited, loses track of the child process and never receives that information. The child process exits normally, but the parent thinks it's still running, and thus is a zombie process born :)
There are a number of steps to take, from simplest to most obscure, to get rid of zombie processes. And then there's what to do if none of that seems to work. Here we go :)
1. First, identify the fact that you have zombie processes running on your system (you may not notice, and there's a good reason why, which we'll address near the end of this post). You can do this on most major brands of Unix and Linux by running:
host # ps -el|grep Z <--- The -l flag to ps will include the "state" column. The zombie state is represented by a capital Z.
On Solaris 9:
host # ps -el|grep Z
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 Z 0 3038 1 0 0 - - 0 - ? 0:00
0 Z 0 19769 2966 0 0 - - 0 - ? 0:00
On SUSE Linux 9:
/home/ymdg001# ps -el|grep Z
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 Z 0 476 9874 0 0 - - 0 - ? 0:00
2. Now that you know you have zombie processes running, the first, and easiest, thing you can do to kill them is to try and "assassinate" the actual defunct (zombie) process. For the process in the SUSE example above, you can always try:
host # kill -9 476
It probably won't work, but it's worth a shot. Sometimes it does and your troubles are over just like that :)
3. Next, you should try to kill the parent process. This may or may not be possible for you. For instance, the parent process may be a process that you "need" to have running. It may also be a process that the Operating System "needs" to have running (like "init" - process 1, shown in the Solaris example above, under the PPID column).
Killing the parent process (if possible) will almost always work to get rid of a zombie process.
Please "never" try to kill init (process 1). If you're successful, your machine will go down hard and fast!
4. Assuming none of the above worked, some common wisdom says you should just give up (and for good reason, which we'll get to very soon ;). However you can try killing both the zombie process (and/or the parent process) using signals other than SIGKILL (or -9). I've seen it happen more than a few times. Different programs trap, and/or handle, different signals different ways. If your zombie doesn't go away when you execute a "kill -9" against it, try a simple "kill" (Which is, technically "kill -15" or SIGTERM). You can try to kill the process with any signal you want. I generally try signals 1 - 15 and then SIGUSR1 and SIGUSR2, just in case they're defined differently for that particular program on that particular system. You'd be surprised how many zombies you can whack with a SIGHUP or SIGINT. Sending a kill SIGCHLD or SIGCLD (Which is the same as SIGCHLD on System V) is a good one to try, as well. Sometimes your chosen method won't make "textbook sense" but it will work from time to time :)
You can find a handy list of signals to try in our old post on translating signal names to numbers and vice versa.
5. And the point I've been alluding to throughout this entire post.
What to do if your zombie process just won't die, you can't kill the parent and/or you're otherwise stuck?
The answer is: nothing.
Here's a brief explanation why: Even though zombie processes alarm most casual users of Unix and/or Linux, and they can make the process table look ugly with all those "defunct" messages scattered in between everything else, a zombie process lives up to its name in more ways than the sense defined above. It literally is like the somewhat-living dead. Although the proc table (and filesystem) have space reserved to record it, the process has already exited and is not consuming any of your system resources. It takes up none of your kernel or system space and is only a minor nuisance since "times" keeps track of its time (If you're a fly, you'll notice the 0:00 slow-down ;)
6. But WAIT!
There's more... (I'm starting to sound like a pitch man ;). Here's one last thing you can do if that ps entry for your zombie process is really bugging you: Once the zombie has totally disconnected from its parent process, you can just use the "wait" command to make it go away. For example:
host # ps -el|grep Z
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 Z 0 3038 1 0 0 - - 0 - ? 0:00
host # id
uid=0(root) gid=0(root)
host # wait 3038
...and when that returns (I'd recommend that you run this with "&" to background it - e.g. "wait 3038 &")
host # ps -el|grep Z
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
It's gone :)
In any event, hopefully, after reading this, you'll no longer worry about zombies :)
Cheers,
Mike
From: http://linuxshellaccount.blogspot.fr/2008/05/killing-zombie-processes-in-linux-and.html
- (601)How to resize images with ImageMagick?
$ convert rose.jpg -resize 50% rose.png
- (609)How to change the name of output files in Grip?
Figure 7.4: Configuring grip is straightforward. This setup uses cdparanoia to read the Audio CD data and lame to convert the resulting WAV files to mp3. Note also that a track number (%t) has been added to the file name.
From: http://www.togaware.com/linux/survivor/Grip.html
- (617)What graphical tools exist for visualizing "diff"s between two files?
xxdiff
(x)emacs ediff mode
vim -d file1 file2
meld
kompare
kdiff3
Diffuse
Guiffy
vimdiff
gvimdiff
tkdiff
colordiff
- (625)How to draw the tree of running processes?
ps auxf
- (694)Basic scripts to run Word/Excel/Powerpoint from wine
wine ~/.wine/drive_c/Program\ Files/Microsoft\ Office/Office12/EXCEL.EXE "$*"
wine ~/.wine/drive_c/Program\ Files/Microsoft\ Office/Office12/POWERPNT.EXE "$*"
wine ~/.wine/drive_c/Program\ Files/Microsoft\ Office/Office12/WINWORD.EXE "$*"
- (696)How to transpose a matrix (i.e. exchange lines/columns)?
if [[ $# != 2 ]]
then
echo "USAGE: $0 <filename> <separator>"
else
file=$1
sep=$2
awk '
{
for (i=1; i<=NF; i++)
{
a[NR,i] = $i
}
}
NF>p { p = NF }
END
{
for(j=1; j<=p; j++)
{
str="a[1,j]"
for(i=2; i<=NR; i++)
{
str=str" "a[i,j];
}
print str
}
}' $file
fi
- (698)How to mount/umount a LUKS encrypted file?
###### MOUNT
losetup /dev/loop0 /home/gmuller/Work/AirPX/luksfile.JSUN0\!
cryptsetup luksOpen /dev/loop0 airpx # map the loop device to a /dev/maaper device
mount /dev/mapper/airpx # mounts the encrypted file
###### UMOUNT
umount /dev/mapper/airpx # unmounts the encrypted file
cryptsetup luksClose /dev/mapper/airpx # unmap the loop device to a /dev/maaper device
losetup -d /dev/loop0 # detaches the crypted file
- (699)Scripts to quickly check for spelling
echo "$1" | aspell -a -d french
echo "$1" | aspell -a -d english
- (705)Script to uncompress file in batch
#TODO : test error return and/or "Everything is OK" and remove $i
for i in *.[Zz][Ii][Pp] *.[Rr][Aa][Rr] ; do 7z x $i ; done
- (719)How to get the week number?
For today:
$ date +%W
17
For any date in the past/future:
$ date -d"04/15/2012" +%W
- (733)Which is the quicker between "sed" and "tr" to strip a string?
Answer: "tr" !
$ time seq 1 5000000 | tr '\n' ',' | sed -e 's/[,;]//g' > /dev/null
real 0m4.096s
user 0m4.140s
sys 0m0.170s
$ time seq 1 5000000 | tr '\n' ',' | tr -d ',' | tr -d ';' > /dev/null
real 0m3.122s
user 0m3.230s
sys 0m0.100s
- (735)How to beautifully convert a PDF to a PNG?
convert -density 600x600 -resize '2048x!' -quality 90 toto.pdf toto.png
- (736)How to do a cp with a progressbar?
cat $1 | pv -s -L $size -p -e -r > $2
cat $1 | pv -s 1m -p -e -r > $2
rsync --stats --progress
From: http://www.mjmwired.net/linux/2008/09/26/copy-with-a-progress-bar/
- (737)How to get the list of all installed packages in Ubuntu-based distros?
dpkg --get-selections
- (738)How to cleanly reinstall a package in Ubuntu-based distros?
apt-get install --reinstall -y <pkgname>
- (739)How to force the install a package in Ubuntu-based distros?
apt-get install -f <pkgname>
- (740)How to remove all files when removing a package in Ubuntu-based distros?
apt-get remove --purge <pkgname> # the purge applies to all "remove" cmds even for dependencies
or
apt-get purge <pkgname> # purges only the named packages
- (755)How to know which video driver is currently in use on my system?
$ jockey-text -l
or:
$ lshw -c video
look for the line with "configuration". The loaded driver is prefixed with "driver:"
Then
$ modinfo i915
From: http://askubuntu.com/questions/23238/how-can-i-find-what-video-driver-is-in-use-on-my-system
- (756)How to prevent a Linux kernel module from auto loading (a.k.a how to prevent nouveau from crashing regularly your machine)?
If you are using CentOS/Redhat/RHEL/Fedora Linux...
Just open your /etc/modprobe.conf file and turn of auto loading using following syntax:
alias driver-name off
If you are using Debian / Ubuntu Linux...
open /etc/modprobe.d/blacklist file and add drivername using following syntax:
blacklist driver-name
From: http://www.cyberciti.biz/tips/avoid-linux-kernel-module-driver-autoloading.html
- (765)How to Auto Mount Drives at System Startup in Linux Mint 13
- Go to Menu > Software Manager, type pysdm into the Search box and press "Enter".
- Select "pysdm" and click "Install" if it has not been installed.
- Go to Menu > Applications > Administration > Storage Device Manager.
- Extend the list of sda and select the sda you want to auto mount, click 'OK' to configure.
- Click the "Assistant" button.
- Uncheck "Mount file system in read only mode" and keep "The file system is mounted at boot time" checked.
- Click the "Mount", "Apply" then "Close" button, and restart the system.
From: http://www.techsupportalert.com/content/tips-and-tricks-ubuntu-after-installation-ubuntu-1204.htm
- (773)How to install/update packages AND THEIR DEPS on a machine with internet access on the box?
Use Keyrix: http://www.le-libriste.fr/2010/01/keyrix-gestionnaire-de-package-apt-offline/
- (783)How to list M$ machines on an SMB network?
$ smbtree -N
- (787)How to solve error: "WARNING: The following packages cannot be authenticated!" in Ubuntu/Debian?
- Update the ftp server key with sudo apt-key update command.
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com votre_n°_de_cle
From: http://doc.ubuntu-fr.org/apt-key
- Run the sudo apt-get update command to update the source list.
From: https://answers.launchpad.net/ubuntu/+source/update-manager/+question/88266
- (791)How to manage services in ubuntu/debian?
- Starting a Service
# Traditional:
/etc/init.d/myservice start
# Upstart
service myservice start
- Stopping a Service
# Traditional:
/etc/init.d/myservice stop
# Upstart
service myservice stop
- Getting a list of Services
# Traditional:
ls /etc/init.d
# Upstart:
service --status-all
- Adding a Service to Default runlevels
update-rc.d apache2 defaults
- Removing a Service from Default runlevels
rm /etc/rc*/*myscript
- Interesting files:
/etc/init is where the upstart init configs live. While they are not scripts themselves, they essentially execute whatever is required to replace sysvinit scripts.
/etc/init.d is where all the traditional sysvinit scripts and the backward compatible scripts for upstart live. The backward compatible scripts basically run service myservice start instead of doing anything themselves. Some just show a notice to use the "service" command.
/etc/init/rc-sysinit.conf controls execution of traditional scripts added manually or with update-rc.d to traditional runlevels in /etc/rc*
/etc/default has configuration files allowing you to control the behaviour of both traditional sysvinit scripts and new upstart configs.
From: https://help.ubuntu.com/community/UbuntuBootupHowto
- (792)How to correct error "<some-package>: Depends: <other-package> (= version) but this-version is to be installed" in apt-get?
- make sure that the "restricted" and "universe" repositories are enabled
- sudo apt-get clean ; sudo apt-get autoclean
- sudo apt-get -f install ; sudo dpkg --configure -a ; sudo apt-get -f install
- sudo apt-get -u dist-upgrade ; sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade
- Disable/Remove/Purge PPAs (e.g. in synaptic), then:
sudo apt-get install ppa-purge
sudo ppa-purge ppa:someppa/ppa
- sudo apt-get autoremove --purge package-name
sudo add-apt-repository --remove ppa:someppa/ppa
sudo apt-get autoclean
From: http://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies
- (793)How to prevent messages from other users to be printed to the console?
write/talk/ytalk, etc. allow to send message to other users on the machine.
to prevent these message to appear on your console/terminal, use:
mesg n # To be done for each tty you are logged in!
- (794)How to set/unset the proxy in CLI in ubuntu? [a.k.a how to set a gnome property w/o using gnome?]
-- Unset
unset no_proxy
unset http_proxy
unset https_proxy
unset ftp_proxy
unset socks_proxy
gsettings set org.gnome.system.proxy mode 'none'
gsettings set org.gnome.system.proxy.http enabled false
# Could be ignored?
gsettings set org.gnome.system.proxy.http host ''
gsettings set org.gnome.system.proxy.http port 0
gsettings set org.gnome.system.proxy.http use-authentication false
gsettings set org.gnome.system.proxy.https host ''
gsettings set org.gnome.system.proxy.https port 0
gsettings set org.gnome.system.proxy.ftp host ''
gsettings set org.gnome.system.proxy.ftp port 0
gsettings set org.gnome.system.proxy.socks host ''
gsettings set org.gnome.system.proxy.socks port 0
gsettings set org.gnome.system.proxy use-same-proxy false
gsettings set org.gnome.system.proxy ignore-hosts "[ 'localhost', '127.0.0.0/8' ]"
-- Set
export no_proxy=localhost,127.0.0.1,*.example.com
export http_proxy=http://cache.polytechnique.fr:8080/
export https_proxy=https://cache.polytechnique.fr:8080/
export ftp_proxy=ftp://cache.polytechnique.fr:8080/
# export socks_proxy=socks://cache.polytechnique.fr:8080/
# Configuration
gsettings set org.gnome.system.proxy.http host 'cache.polytechnique.fr'
gsettings set org.gnome.system.proxy.http port 8080
gsettings set org.gnome.system.proxy.http use-authentication false
gsettings set org.gnome.system.proxy use-same-proxy false
gsettings set org.gnome.system.proxy.https host 'cache.polytechnique.fr'
gsettings set org.gnome.system.proxy.https port 8080
gsettings set org.gnome.system.proxy.ftp host 'cache.polytechnique.fr'
gsettings set org.gnome.system.proxy.ftp port 8080
gsettings set org.gnome.system.proxy.socks host ''
gsettings set org.gnome.system.proxy.socks port 0
# Enabling
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.http enabled true
gsettings set org.gnome.system.proxy ignore-hosts "[ 'localhost', '127.0.0.0/8' ]"
- (797)How to change the base directory of UbuntuOne?
In ~/.config/ubuntuone/syncdaemon.conf add:
[__main__]
root_dir = ~/new/folder
From: http://ubuntuforums.org/showthread.php?t=1291425
- (801)How to create the root user in Ubuntu?
$ sudo passwd root
From: http://en.kioskea.net/faq/12775-ubuntu-create-a-root-password
- (809)How to know the used/free/total RAM available in Linux?
cat /proc/meminfo
From: http://www.cyberciti.biz/faq/linux-check-memory-usage/
cat /sys/devices/system/node/node0/meminfo
From: http://stackoverflow.com/questions/4724259/relation-between-linux-proc-meminfo-and-sys-devices-system-node-nodex-meminfo
- (810)How to know the used/free CPU usage in Linux?
cat /proc/stat
From: http://askubuntu.com/questions/68741/finding-cpu-usage-from-top-command
From: http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html
TODO: and with /sys ????
From: ???
- (811)How to know the used/remaining battery usage in Linux?
cat /proc/acpi/battery/BAT0/state
From: http://www.tldp.org/HOWTO/ACPI-HOWTO/usingacpi.html
cat /sys/class/power_supply/BAT0/charge_*
From: https://bbs.archlinux.org/viewtopic.php?id=128453
- (812)How to move back to alsa instead of pulseaudio?
1. Remove pulseaudio
apt-get autoremove pulse??
2. If your username don't belong also in the audio group, you should
add your user as a member of it, like
sudo usermod -a -G audio <your_login_name>
From: http://cmc.site11.com/2011/01/ubuntu-10-04-alsamixer-cannot-open-mixer-no-such-file-or-directory-solved/
- (814)How to swap Ctrl-Caps in console in Linux?
$ sudo dumpkeys > /usr/share/keymaps/Caps2Ctrl.map
Then add the following lines to that file:
keycode 58 = Control #This makes Caps act as Ctrl
keycode 29 = Caps_Lock #This makes Ctrl act as Caps
# alt_is_meta #This fixes the Alt key
Then run loadkeys on that file:
$ sudo loadkeys /usr/share/keymaps/Caps2Ctrl.map
From: http://emacswiki.org/emacs/MovingTheCtrlKey#toc7
- (815)How to access Google Drive for Ubuntu ? DOES NOT GET SHARED FILES!!
install Grive
From: http://www.webupd8.org/2012/05/grive-open-source-google-drive-client.html
- (816)How to access Google Docs for Ubuntu ? BAD
Step 1: Download all the packages that you can find here by Luca Invernizzi and proceed to second step.
Step 2: Add the following package
sudo add-apt-repository ppa:invernizzi/google-docs-fs
sudo apt-get update && sudo apt-get install google-docs-fs
Step 3: Once the installation completed, logout and login again to your Ubuntu Desktop.
Step 4: Now open -YŽNautilus¡ and Create a New Folder in your ŽHome¡ folder as ŽDrive¡.
Step 5: Access ŽTerminal¡ and type the following command
gmount Drive username@gmail.com
(replace the username with your google account detail to access your Google Drive)
Step 6: You must see a prompt for Password, and give your google account password to complete the steps and you must be seeing the Google Drive with your Free Cloud Storage now mounted as a Virtual Drive.
From: http://www.dailytut.com/linux/google-drive-ubuntu.html
- (819)How to build an alarm clock or sleeping schedule with Audacious?
Enable the "Alarm" plugin that comes with Audacious and that solves the wake-up part. Then I start playing a song and type in a terminal "sleep 30m; audacious -s" where you can change 30m (30 minutes) to 1h (1 hour) or whatever duration you wish it should play before stopping.
From: http://ubuntuforums.org/showthread.php?t=903962
- (821)How to change the hostname in Ubuntu?
http://www.tech-recipes.com/rx/2732/ubuntu_how_to_change_computer_name/
http://ubuntuforums.org/showthread.php?t=799896
*Re: sudo: unable to resolve host*
------------------------------------------------------------------------
Yup. If you change the hostname in /etc/hostname, you must also fix up /etc/hosts so the new name resolves to 127.0.0.1. The safest way is to edit hosts and add the new name, then edit hostname, then go back to hosts to remove the old hstname.
- (822)How to use gnome-open to open pdf files? [a.k.a how to change file association for Ubuntu/Gnome]
Fourth Approach
I could reproduce your problem by deleting this file /usr/share/applications/evince.desktop, so make sure you have this file.
Third Approach
xdg-open appears to use the configuration of /etc/mailcap. So edit it to associate pdf with evince.
gksu gedit /etc/mailcap
Look for the lines that begin with application/pdf; application/x-pdf; application/x-bzpdf; application/x-gzpdf. They should look like this to associate pdf with evince:
application/pdf; evince '%s'; test=test -n "$DISPLAY"; nametemplate=%s.pdf
application/x-pdf; evince '%s'; test=test -n "$DISPLAY"; nametemplate=%s.pdf
application/x-bzpdf; evince '%s'; test=test -n "$DISPLAY"; nametemplate=%s.pdf.bz2
application/x-gzpdf; evince '%s'; test=test -n "$DISPLAY"; nametemplate=%s.pdf.gz
Second Approach
What is the output of
xdg-mime query filetype foo.pdf
If the output isn't what we should expect, then:
xdg-mime default evince.desktop application/pdf
First Approach
There are other places that the file associations are set.
You may change the files associations at:
/usr/share/applications/defaults.list
/usr/share/applications/mimeinfo.cache
~/.local/share/applications/
~/.gnome/share/apps/
Look for "pdf" and for "Nautilus" inside theses files.
From: http://askubuntu.com/questions/35602/using-gnome-open-to-open-pdf-files
- (824)How to install a specific version of grails in Ubuntu?
sudo add-apt-repository ppa:groovy-dev/grails
sudo apt-get update
sudo apt-get install grails-ppa
#to add grails 2.0.x
sudo apt-get install grails 2.0.x
#to add grails 1.3.9
sudo apt-get install grails-1.3.9
#to add grails 1.2.5
sudo apt-get install grails-1.2.5
#switch between versions
sudo update-alternatives --config grails
From: http://grails.org/download/ubuntu
- (825)How to create Application launcher and add icon to Unity in Ubuntu 12.10?
sudo gnome-desktop-item-edit /usr/share/applications/ --create-new
From: http://www.howopensource.com/2012/10/create-application-launcher-add-icon-to-unity-ubuntu-12-10/
- (826)How to disable guest account in ubuntu 12.04?
$ gksudo gedit /etc/lightdm/lightdm.conf
Add the following line:
allow-guest=false
From: http://www.ubuntugeek.com/ubuntu-tiphow-to-disable-guest-account-in-ubuntu-12-04precise.html
- (827)How to disable the overlay scrollbars in Ubuntu?
sudo apt-get remove overlay-scrollbar liboverlay-scrollbar-0.1-0
sudo su
echo "export LIBOVERLAY_SCROLLBAR=0" > /etc/X11/Xsession.d/80overlayscrollbars
- (828)How can I move the window buttons to the top right of the window in Ubuntu?
Press Alt+F2 to open the Run Application window.
Type gconf-editor into the text box and click Run to start the Configuration Editor.
Open /apps/metacity/general using the side pane and double-click the button_layout item.
Change the value to say
:minimize,maximize,close
(the position of the colon determines which side of the window the buttons appear on).
Click OK and the location of the windows buttons will change immediately.
From: https://help.ubuntu.com/10.04/config-desktop/C/window-button-order.html
- (836)How to set proxy for apt-get?
- Temporary proxy session
This is a temporary method that you can manually use each time you want to use apt-get through a http-proxy. This method is useful if you only want to temporarily use a http-proxy.
Enter this line in the terminal prior to using apt-get (substitute your details for yourproxyaddress and proxyport).
$ export http_proxy=http://yourproxyaddress:proxyport
If you normally use sudo to run apt-get you will need to login as root first for this to work unless you also add some explicit environment settings to /etc/sudoers, e.g.
Defaults env_keep = "http_proxy https_proxy ftp_proxy"
- APT configuration file method
This method uses the apt.conf file which is found in your /etc/apt/ directory. This method is useful if you only want apt-get (and not other applications) to use a http-proxy permanently.
On some installations there will be no apt-conf file set up. This procedure will either edit an existing apt-conf file or create a new apt-conf file.
$ gksudo gedit /etc/apt/apt.conf
Add this line to your /etc/apt/apt.conf file (substitute your details for yourproxyaddress and proxyport).
Acquire::http::Proxy "http://yourproxyaddress:proxyport";
Save the apt.conf file.
- BASH rc method
This method adds a two lines to your .bashrc file in your $HOME directory. This method is useful if you would like apt-get and other applications for instance wget, to use a http-proxy.
gedit ~/.bashrc
Add these lines to the bottom of your ~/.bashrc file (substitute your details for yourproxyaddress and proxyport)
http_proxy=http://yourproxyaddress:proxyport
export http_proxy
Save the file. Close your terminal window and then open another terminal window or source the ~/.bashrc file:
$ source ~/.bashrc
Test your proxy with sudo apt-get update and whatever networking tool you desire. You can use firestarter or conky to see active connections.
If you make a mistake and go back to edit the file again, you can close the terminal and reopen it or you can source ~/.bashrc as shown above.
$ source ~/.bashrc
- How to login a proxy user
If you need to login to the Proxy server this can be achieved in most cases by using the following layout in specifying the proxy address in http-proxy. (substitute your details for username, password, yourproxyaddress and proxyport)
http_proxy=http://username:password@yourproxyaddress:proxyport
From: https://help.ubuntu.com/community/AptGet/Howto#Setting_up_apt-get_to_use_a_http-proxy
- (838)How to work with UbuntuOne in CLI?
u1sdtool --start &
u1sdtool --status &
u1sdtool --current-transfers &
u1sdtool --quit
u1sdtool --connect
u1sdtool --refresh-shares
- (841)How to solve error "No protocol specified" or "Gtk-WARNING **: cannot open display: :0" when running sudo in Ubuntu/LinuxMint?
$ su $USER -c 'xhost local:$USER; <command>'
Or simply add "xhost local:root" in root's .bashrc
From: http://ubuntuforums.org/showthread.php?t=759389
Pour info, je ne sais pas si tu te rappelles, j'avais un problème avec VirtualBox que toi tu n'avais pas : quand je lançais avec sudo, Ubuntu me faisait une erreur "No protocol specified" ou "Gtk-WARNING **: cannot open display: :0". J'ai le même problème de nouveau à mon nouveau taff.
Je viens de trouver le problème et la solution : j'avais créé un "vrai" utilisateur root. Du coup, le squelette de .bashrc avait été copié dans /root. Or, ce dernier ne définit pas les infos Xorg. En ajoutant "xhost local:root" dans le .bashrc, ça remarche :) (si j'ai bien compris, ça dit en tant que quel utilisateur les affichages doivent être fait)
- (848)How to make UbuntuOne work again after an upgrade?
Error: Failure: ubuntuone.platform.tools.linux.IPCError: org.freedesktop.DBus.Error.NoReply
I have solved the issue here. First login into https://login.ubuntu.com/, click the Applications tab and remove the devices. Then:
/bin/rm -fr ~/.config/ubuntuone
/bin/rm -fr ~/.cache/ubuntuone/
/bin/rm -fr ~/.local/share/ubuntuone/
From: https://bugs.launchpad.net/ubuntuone-control-panel/+bug/966731
- (854)How to convert flac to mp3?
1. install "flac" and "lame"
2. run :
for file in *.flac; do flac -cd "$file" | lame -h - "${file%.flac}.mp3"; done
From: http://pinehead.tv/linux/solution-converting-flac-to-mp3/
- (855)How to prevent annoying auto-mount of non-existing floppy/fd0 in LinuxMint14?
echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklist-floppy.conf && sudo rmmod floppy && sudo update-initramfs -u
From: http://forum.linuxmint.com/viewtopic.php?f=200&t=77720
- (856)How to install pattented software to view DVD (Ubuntu)?
Ubuntu 10.04 (i386, amd64), 10.10, 11.04, 11.10, 12.04, and 12.10 (i386, amd64)
Works for old releases that are no longer supported if you have repositories on Cd/Dvd or somewhere. So, anything from 9.04 onwards. The last LTS, 10.04, worked this way. The current LTS, 12.04 and the recent 12.10 also work this way.
Install the libdvdread4 package (no need to add third party repositories) via Synaptic or command line: (note: if you have installed *ubuntu-restricted-extras this has already been installed automatically for you)
sudo apt-get install libdvdread4
Then open a terminal window and execute:
sudo /usr/share/doc/libdvdread4/install-css.sh
From: https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs
- (870)How to make Skype use the correct default browser?
Pb: Setting FF as the system default browser (from FF itself) is not sufficient.
sudo update-alternatives --config x-www-browser
From: http://crunchbang.org/forums/viewtopic.php?id=16411
- (879)How to make Alps touchpad work on Ubuntu 12.10? DOES NOT WORK
0) Get: http://www.dahetral.com/public-download/psmouse-alps-dst-1.0.tbz/at_download/file
1) Extract psmouse-alps-dst-1.0.tbz in /usr/src/ sudo rights. Extracting it on the Downloads folder (right click the file -> Extract here) and moving it with the following command in the terminal also works:
sudo mv psmouse-alps-dst-1.0 /usr/src
ps: Note that the folder you need to move is inside 'usr/src/' folder that you extracted.
2) Go to /usr/src/ and then just give those commands in the terminal:
sudo dkms build psmouse/alps-dst-1.0
sudo dkms install psmouse/alps-dst-1.0
sudo rmmod psmouse && sudo modprobe -v psmouse
From: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/606238/comments/227
http://en.community.dell.com/support-forums/software-os/f/3525/t/19455247.aspx?PageIndex=1
- (112)Build the DVD ISO from site dump (for i386 arch)
mkisofs -vrTJV "OpenBSDXY" -b X.Y/i386/cdromXY.fs -c boot.catalog -o OpenBSDXY.iso /tmp/OpenBSD/
where:
* XY is the version number.
* /tmp/OpenBSD contains the 'i386/' and 'packages/i386' subdirs, plus the following files: ANNOUNCEMENT ftplist HARDWARE PACKAGES PORTS ports.tar.gz README root.mail SIZES src.tar.gz sys.tar.gz
* -v is verbose mode
* -r is rockridge support
* -T is TRANS.TBL generation
* -J is joliet support
* -V is volume ID
- (113)mount / umount a disk image
# vnconfig -c /dev/svnd0c /the/disk/image
# mount /dev/svnd0a /mnt
# umount /dev/svnd0a
# vnconfig -u /dev/svnd0c
- (141)How to change the kernel configuration
config -e -o bsd.new /bsd
- (143)Equivalent of strace.
use kdump + ktrace
- (150)Under OpenBSD, when someone runs 'java -XmxYYY' and YYY is greater than the (bash-)allowed data seg size for a process, then java just closes while complaining.
Unfortunately 'ulimit -d' did not help, returning a "operation not permitted". Indeed, I felt that the limitation comes from 'above': it might be limited by some configuration that is set for the current bash at launch-time.
The dialog below indicates a solution: the launch-time configuration of bash is in /etc/login.conf.
> Indeed! Please keep us posted! I'd wager that you're ready to go if
> you can unlimit the data seg size.
I found that the default settings (modifiable in /etc/login.conf) are
a soft limit of 64MB and a hard limit of 256MB.
- (156)If X has trouble launching itself (driver initialization problems)
Might be linked with allowing access to hardware
machdep.allowaperture=2
machdep.userldt=1
- (162)How to allow users to mount drives
One (violent) solution is to add them the the sudoers or wheel group.
Another, more secure, is to set the kern.usermount to 1:
# sysctl kern.usermount=1
ATTENTION:
http://en.wikibooks.org/wiki/Guide_to_Unix/Explanations/Filesystems_and_Swap#Mounts_by_Users
"The user can pick any mount point which the user owns."
This means you cannot mount /dev/cd0c in /mnt/dvdrom since you probably do not have rwx rights on /mnt/... . However, you can mount cd or USB sticks in ~/mytmp ;)
- (164)Del Key do not act correctly in Terminal
http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html
--------
* Typing <CTRL>-V <BS> and <CTRL>-V <DEL> both yield "^?" so bash sees them as the same key.
* xev shows they are distinct, namely (keycode 22 / BackSpace) and (keycode 107 / Delete).
* The readline binding of \C-? is backward-delete-char. In my .inputrc I have these definitions:
Code:
"^?" : delete-char
"\C-h" : delete-char
"\C-?" : delete-char
In some vain attempt to get <DEL> to do delete-char but to no avail. After doing bind -f .inputrc (even though it is definitely loaded when bash starts), bind -p | grep delete shows that \C-? is still bound to backward-delete-char.
* I can do bind '^?=delete-char-forward' in ksh, after which both <DEL> and <BS> delete the current char, but this is still a problem since I want them to be different. Probably related to the first point above.
----------
In my ~/.Xresources file I have mapped the Delete keys to a string:
Code:
*VT100.Translations: #override \
!<Key>BackSpace: string(0x7F) \n\
!<Key>KP_Begin: string(0x1b) string("[25~") \n\
!<Key>Home: string(0x1b) string("[7~") \n\
!<Key>KP_Home: string(0x1b) string("[7~") \n\
<Key>Insert: string(0x1b) string("[2~") \n\
!<Key>KP_Insert: string(0x1b) string("[2~") \n\
<Key>Delete: string(0x1b) string("[3~") \n\
!<Key>KP_Delete: string(0x1b) string("[3~") \n\
...(etc.)...
Note the last two lines especially. Then, in my ~/.inputrc I use that string:
Code:
"\e[3~": delete-char # Delete
I hope that can get you started on what you want to do. (BTW, thanks for the tip about Ctrl-V, didn't know about that.)
----------
"David, you probably need to reload the Xresources file with: xrdb -merge ~/. Xresources.
----------
# Make sure the backspace key erases:
stty erase "^H"
Reply With Quote
----------
http://www.daemonforums.org/showthread.php?t=2560
----------
Finally, if all this did not work:
CTL+Right clic in terminal window and select "Delete is DEL"
- (166)Problems playing sound with multiple softs (e.g. xmms) at the same time
esd (to have several progs playing sound at the same time => no gnash crash if /dev/audio is already used - gnash as to be configured to use esd also using gst-esd) : pkg_add xmms-esd
cdda / digital audio extraction => change xmms for audacious!
UPDATE: OpenBSD 4.5 introduced aucat (launch aucat -l once for all at boot)
- (173)Boot problem
if you have a line in fstab to mount XXX in /boot (even in
noauto mode), and if /boot exists but IS A FILE (e.g.,
copy of /usr/mdec/boot) and not a directory
=> boot is stopped
- (181)How to restore/reset MBR
1. fdisk -u
2. /usr/mdec/installboot -[n]v /usr/mdec/boot /usr/mdec/biosboot wd0
- (183)How to get the serial number on a Dell machine
sysctl | grep serial
hw.serialno=404CW3J
- (185)How to switch off the bell
$ wsconsctl
keyboard.bell.pitch=400
keyboard.bell.period=100
keyboard.bell.volume=50
keyboard.bell.pitch.default=400
keyboard.bell.period.default=100
keyboard.bell.volume.default=50
$ xset b off
$ xset b on
- (192)How to change a mounted disk options (e.g., remount RW a partition mounted RO by Single User boot)
mount -u -o <option>
e.g.: mount -u -o rw
- (193)Qemu refuses to start because it cannot allocate enough memory (a.k.a "Could not map physical memory" error)
Under OpenBSD there is a limit on the amount of memory for user processes.
- 'ulimit -d' allows to dynamically change the value.
- However, there is a harder limit that even ulimit cannot change. It is set in the /etc/login.conf (:datasize-max=xxxM and :datasize-cur=yyyM)
- (216)How to set the brightness/luminosity of the screen
wsconsctl display.brightness=100.00%
- (228)Get colors in XTerm and vi
#pkg_add colorls vim
$echo "export TERM=xterm-color" >> .xinitrc
$echo "alias ls='colorls -Gahl'" >> .bashrc
$echo "alias vi='vim'" >> .bashrc
- (238)How to replace an installed package with another of its flavors
use option -r of pkg_add
e.g. replace an installed ghostscript-8.63p11 by ghostscript-8.63p11-a4:
# pkg_add -r ghostscript-8.63p11-a4
- (239)How to install two machines with the exact same packages (or brutally remove all packages and re-install them, for instance to move from i386 to amd64)
use option -l of pkg_add
machine1# pkg_info > list_of_packages
machine2# pkg_add -l list_of_packages
- (243)Resolve error Gtk-WARNING **: Error loading theme icon 'xxx' for yyy: Unrecognized image file format
- remove ~/.local?
- change .gtkrc-2.0 to point to an installed theme (or simply remove it...)
- (268)Make a crypted file system / mounted point / directory
$ touch <cryptedfs file>
$ dd if=/dev/[u]random of=<cryptedfs file> bs=512 count=<cryptedfs size in blocks>
# vnconfig -ck -v svnd0 <cryptedfs file>
# fdisk -i svnd0
# disklabel -E svnd0 # add a 'a' slice taking all free space
# newfs svnd0a
# mount /dev/svnd0a <cryptedfs mount point>
- (275)Should we use /dev/random or /dev/urandom ?
> On the line
> dd if=/dev/urandom of=$CRYPTFILE bs=1M count=$CRYPTSIZE
> why not /dev/random instead? Isn't that more secure?
/dev/random blocks until more entropy can be gathered
On the N900, producing even 1 kilobyte of random data with /dev/random takes ages (it just sits there waiting for environment "noise")
/dev/urandom takes less a second to fill 1 MB of random data
Unless you are exchanging above top secret government documents, /dev/urandom is good enough.
From: http://talk.maemo.org/showthread.php?t=40154
- (278)How to use UTF8 in Xorg, while not touching the console configuration
It would be very hard to make the text console support UTF-8 display.
That is certainly out-of-scope for me. I won't touch that.
It's definitely not a good idea to run the entire system with
LC_CTYPE=en_US.UTF-8 in the environment.
It's a bad idea to set LC_CTYPE=en_US.UTF-8 in ~/.profile, because
it could cause gibberish being displayed on the text console.
I run my entire X session with LC_CTYPE=en_US.UTF-8, like this:
$ cat ~/.xsession
env LC_CTYPE="en_US.UTF-8" /usr/local/bin/startxfce4
I'd recommend doing it this way when helping with testing.
The most important thing to look out for is stuff that used to work
with single-byte character sets like ISO8859-1 but does not work with UTF-8.
- (286)How to compile a pkg from current into stable?
-1. # chmod a+w /usr/ports/
0. $ cd ~/
1. $ cvs -danoncvs@anoncvs.fr.openbsd.org:/cvs co ports/productivity/sunbird
2. $ mv ~/ports/productivity/ /usr/ports/mystuff
3. $ cd /usr/ports/productivity/sunbird/
4. $ make package
- (293)How to compile a custom kernel (for instance to enable NFTS reading)
# cd /usr/src/sys/arch/`machine`/conf
# cp GENERIC GENERIC.NTFS
# vi GENERIC.NTFS # + add "option NTFS"
# config GENERIC.NTFS
# cd ../compile/GENERIC.NTFS
# make clean && make depend && make
[...lots of output...]
# make install
- (294)What device to use to check a Crypted FS FFS file?
1. bind the FFS file to an svnd device (e.g. svnd0)
2. fsck_ffs /dev/rsvnd0a
- (296)What to do if the sound does not come back correctly when OpenBSD48 is APM-suspended?
when there is no sound played, apm -z does not necessarily reloads correctly the aucat -l
=> kill and restart it as a user
- (300)After upgrading, how to see if there are ".libXXX" packages to be cleaned?
pkg_info -A | cut -d ' ' -f 1 | grep '\.lib'
- (316)What to do if arrow keys do not work in aMule under OpenBSD/awesome?
its probably because the area is not selected correctly => use tab to select the good part, then the arrow will work correctly ;)
- (320)An equivalent of lsof in OpenBSD
fstat
- (325)Problems when using Home and End keys when xterm is set to use colors (TERM=xterm-xfree86 or TERM=xterm-colors) and utf8 (Open 48++)
In fact, these keys are not working.
When the text moves (colors chars are offsetting it?) just do:
CTL-e/End (goto end of line) and CTL-l (clear screen)
Then, do not use CTL-a/CTL-e or End/Home, rather use CTL-rightarrow and CTL-leftarrow
reset ?
- (326)How to get Evolution's notifications to appear?
http://lists.debian.org/debian-user/2010/09/msg00039.html
For now created the following wrapper:
#!/bin/sh
/usr/lib/evolution/2.30/evolution-alarm-notify &
exec /usr/bin/evolution
---
In openbsd: add
/usr/local/libexec/evolution/2.28/evolution-alarm-notify &
in your .xinitrc
- (327)What is the boot process sequence?
schmilblick (MBR) -> biosboot (PBR) -> /boot (on the slice) -> /bsd (kernel, on the slice)
- (328)What command line editor to use?
- vi
- mg (emacs-like)
- (330)What is the equivalent of lsusb in OpenBSD?
usbdevs
usbctl (in pkg: usbutil)
- (335)What to do right after the end of the install of an OpenBSD box?
The install program leaves root an initial mail message. We recommend
you read it, as it contains answers to basic questions you might have
about OpenBSD, such as configuring your system, installing packages,
getting more information about OpenBSD, sending in your dmesg output
and more. To do this, run
mail
and then just enter "more 1" to get the first message. You quit mail by
entering "q".
Some of the files in the OpenBSD 4.9 distribution might need to be
tailored for your site. We recommend you run:
man afterboot
which will tell you about a bunch of the files needing to be reviewed.
If you are unfamiliar with UN*X-like system administration, it's
recommended that you buy a book that discusses it.
- (378)What if Xorg does not start?
Particularly after a fresh install (generally not an upgrade), verify that sysctl's aperture is set to 2
- (379)How to manually install the base system?
#From: http://openbsd.org/faq/faq4.html
Using the upgrade process
Simply boot your install media (CD-ROM or Floppy), and choose Upgrade (rather than Install). When you get to the lists of file sets to install, choose the sets you neglected to install first time around, select your source, and let it install them for you.
Using tar(1)
The install file sets are simply compressed tar files, and you can expand them manually from the root of the filesystem:
# cd /
# tar xzvphf comp49.tgz
***Do NOT forget the 'p' option in the above command in order to restore the file permissions properly!***
One common mistake is to think you can use pkg_add(1) to add missing file sets. This does not work. pkg_add(1) is the package management tool to install third party software. It handles package files, not generic tar files like the install sets.
If you are installing the xbase file set on your system for the first time using tar(1) and without rebooting, the shared library cache must be updated after the installation using ldconfig(8). To add all the X libraries to the cache:
# ldconfig -m /usr/X11R6/lib
Alternatively, you can just reboot your system, and this will be done automatically by the rc(8) startup script.
- (389)My pf.conf
# $OpenBSD: pf.conf,v 1.49 2009/09/17 06:39:03 jmc Exp $
#
# See pf.conf(5) for syntax and examples.
# Remember to set net.inet.ip.forwarding=1 and/or net.inet6.ip6.forwarding=1
# in /etc/sysctl.conf if packets are to be forwarded between interfaces.
set skip on lo
# block in all
# filter rules and anchor for ftp-proxy(8)
anchor "ftp-proxy/*"
pass in quick proto tcp to port ftp rdr-to 127.0.0.1 port 8021
# anchor for relayd(8)
#anchor "relayd/*"
pass # to establish keep-state
# rules for spamd(8)
#table <spamd-white> persist
#table <nospamd> persist file "/etc/mail/nospamd"
#pass in on egress proto tcp from any to any port smtp \
# rdr-to 127.0.0.1 port spamd
#pass in on egress proto tcp from <nospamd> to any port smtp
#pass in log on egress proto tcp from <spamd-white> to any port smtp
#pass out log on egress proto tcp to any port smtp
#block in quick from urpf-failed to any # use with care
# By default, do not permit remote connections to X11
block in on ! lo0 proto tcp to port 6000:6010
ext_if=192.168.0.2
dns_port="{domain}"
ssh_port="{22, 2222}"
web_port="{80,8080}"
mail_port="{smtp, pop3, pop3s, imap, imaps}"
ftp_port="{20,21,2100}"
dwl_port="{4400:5999,6500:8000}"
# DNS
pass out on $ext_if proto tcp to any port $dns_port
pass out on $ext_if proto udp to any port $dns_port
# SSH
pass in on $ext_if proto tcp to any port $ssh_port
pass out on $ext_if proto tcp to any port $ssh_port
# Web
pass out on $ext_if proto tcp to any port $web_port
pass out on $ext_if proto udp to any port $web_port
# Mail
pass out on $ext_if proto tcp to any port $mail_port
pass out on $ext_if proto udp to any port $mail_port
# FTP
pass out on $ext_if proto tcp to any port $ftp_port
pass in on $ext_if proto tcp to any port $ftp_port
pass in on $ext_if proto tcp to any port > 49151
# DWL
pass in on $ext_if proto tcp to any port $dwl_port
pass out on $ext_if proto tcp to any port $dwl_port
pass in on $ext_if proto udp to any port $dwl_port
pass out on $ext_if proto udp to any port $dwl_port
- (390)How to configure mg?
global-set-key "\e[H" beginning-of-line
global-set-key "\e[F" end-of-line
global-set-key "\e[1;5C" forward-word
global-set-key "\e[1;5D" backward-word
global-set-key "\e[1;3C" forward-word
global-set-key "\e[1;3D" backward-word
; make C-M-up/dwn keys move by paragraph
;global-set-key "\e[1;5B" forward-block-of-lines ; do not exists in mg
;global-set-key "\e[1;5A" backward-block-of-lines ; do not exists in mg
global-set-key "\e[1;5B" forward-paragraph
global-set-key "\e[1;5A" backward-paragraph
global-set-key "\e[1;5H" beginning-of-buffer
global-set-key "\e[1;5F" end-of-buffer
;;global-set-key "\et" transpose-words
;; allow accentuated chars
meta-key-mode
;; bind ESC-g with goto-line as in XEmacs
global-set-key "\eg" goto-line
;; Makes delete key work
global-set-key "\e[3~" delete-char
;; always end a file with a newline - prevents questions on exit
;(require-final-newline 0)
;; Disables backup files
make-backup-files nil
;; Turn on column numbering in status line
;;(column-number-mode t)
;set-default-mode blink
;auto-indent-mode
;dired-backup-unflag
;;; TODO:
; make ESC-suppr and ESC-dele erase words
- (411)How to switch Control_L/Caps_Lock in console?
[does not work!
wsconsctl keyboard.map+="keysym Caps_Lock = Control_L"
#wsconsctl keyboard.map+="keysym Control_L = Caps_Lock"
]
wsconsctl keyboard.encoding=fr.swapctrlcaps
- (412)How to get a more useable console?
From: http://openbsd.org/faq/faq7.html#80x50
wsfontload -h 8 -e ibm /usr/share/misc/pcvtfonts/vt220l.808
wsconscfg -dF 5
wsconscfg -t 80x50 5
[This can be done automatically at boot by adding the following lines to the end of your rc.local(8)]
The first line above loads the 8x8 font. The second line deletes screen 5 (which would be accessed by [CTRL]+[ALT]+[F6]). The third line creates a new screen 5 with 50 lines of 80 characters each. If you do this, you will see your primary screen, and the other three default virtual consoles, come up in the standard 80x25 mode, but a new screen 5 at 80x50 accessible through [CTRL]+[ALT]+[F6].
- (413)How to split screen in console mode?
Use screen, or BETTER, tmux:
http://openbsd.org/faq/faq7.html#tmux
- (478)How to swap Caps_Lock and Control_Left in console?
wsconsctl keyboard.encoding=fr.swapctrlcaps
- (486)How to search for a program in the ports' tree?
Host ~# cd /usr
Host ~# tar xzf /tmp/ports.tar.gz
Host ~# cd /usr/ports
Host ~# make search key=qemu
- (532)The list of packages that I generally install on a new machine
GraphicsMagick,ImageMagick,ORBit2,OpenEXR,R,Xaw3d,a2ps,aalib,ac3dec,agg,amd,amule,antiword,antlr2,apache,apr,arc,arts,asclock,aspell,atk,atk2mm,audacious,aumix,autossh,avahi,awesome,babl,base64,bash,bison,bladeenc,blame,blas,bluetooth,boehm,boost,bsd,bug,bzip2,cairo,cairomm,cdk,cdparanoia,cdrdao,cdrtools,chmlib,clamav,classpath,clearsilver,cmake,colorls,cups,curl,cvsps,cyrus,db,dbus,dconf,dcraw,decss,desktop,detex,devhelp,dictd,dillo,djview4,djvulibre,docbook,dvd+rw,dvi2tty,e2fsprogs,ectags,eggdbus,ekiga,enchant,enigmail,erlang,esound,evince,evolution,exiv2,exo,faac,faad,fcgi,feh,festival,festlex_CMU,festlex_OALD,festlex_POSLEX,festvox_cmu_us_bdl_arctic_hts,festvox_don,festvox_kallpc16k,festvox_rablpc16k,ffcall,ffmpeg,fftw3,fileutils,findutils,flac,foomatic,freefont,freetype,fribidi,gamin,garcon,gcj,gconf2,gd,gdbm,gdk,gegl,gettext,gftp,ghc,ghostscript,ghostview,giblib,gimp,git,glade3,glib,glib2,glib2mm,glitz,gmake,gmime,gmp,gnome,gnuchess,gnugo,gnumeric,gnupg,gnuplot,gnutls,gocr,goffice,gperf,gphoto,gqview,grip,gsl,gsm,gstreamer,gtar,gtg,gtk+,gtk+2,gtk,gtk2mm,gtkhtml3,gtkimageview,gtksourceview,gtkspell,gucharmap,guile,gv,gvfs,hexedit,hicolor,hpcups,hplip,hs,icu4c,id3lib,ifstat,ijs,ilmbase,imlib,imlib2,inkscape,intltool,iodbc,iso,iso8879,jack,jamvm,jasper,javaPathHelper,jbigkit,jdk,jikes,jpeg,jre,kdebase,kdeedu,kdegraphics,kdelibs,kile,kismet,koffice,kqemu,ktorrent,lame,lapack,lcms,lha,libIDL,liba52,libao,libarchive,libart,libaudiofile,libbonobo,libbonoboui,libcanberra,libcdaudio,libcddb,libcdio,libconfuse,libcroco,libcue,libdaemon,libdca,libdnet,libdockapp,libdv,libdvbpsi,libdvd,libdvdcss,libdvdnav,libdvdread,libebml,libelf,liberation,libev,libexecinfo,libexif,libf2c,libffi,libgadu,libgamin,libgcrypt,libgdata,libgdiplus,libglade2,libgnome,libgnomecanvas,libgnomecups,libgnomekbd,libgnomeprint,libgnomeprintui,libgnomeui,libgpg,libgphoto,libgsf,libgtop2,libguess,libgweather,libical,libiconv,libid3tag,libidn,liblrdf,libltdl,libmad,libmagic,libmatroska,libmikmod,libmms,libmng,libmp4v2,libmpcdec,libmpeg2,libmspack,libnasl,libnotify,libogg,liboil,libpaper,libpqxx,libproxy,libpst,librsvg,libsamplerate,libsexy,libshout,libsigc++,libsigsegv,libslang,libsndfile,libsoup,libspectre,libstdc++,libtasn1,libtheora,libtool,libungif,libunique,libusb,libvorbis,libvpx,libwmf,libwnck,libwpd,libxdg,libxfce4ui,libxfce4util,libxfcegui4,libxklavier,libxml,libxslt,libyaml,lightning,links,lsof,lua,luarexlib,luasocket,luastdlib,lyx,lzo,lzo2,lzop,mc,mcs,meanwhile,memtester,metaauto,metacity,midori,minitube,mldonkey,mono,monodevelop,mousepad,mowgli,mozilla,mplayer,mysql,nasm,neon,nessus,net,netpbm,nmap,notification,nspr,nss,ntp,octave,oniguruma,opal,openclipart,openjpeg,openldap,openmotif,openoffice,orc,osd_clock,ossp,p5,p7zip,pango,pangomm,pciutils,pcre,pdfjam,pgadmin3,physfs,png,polkit,poppler,popt,postgresql,ps2eps,pstree,psutils,ptlib,py,python,qemu,qgo,qt3,qt4,qtoctave,quake2,quirks,raptor,rarian,rdesktop,recordmydesktop,redis,redland,rednotebook,regionset,rlwrap,rsync,ruby,sane,scanssh,schroedinger,scribus,sdl,shared,silc,skill,slib,smpeg,sound,soundtouch,sox,speex,sqlite3,ssldump,startup,streamripper,subversion,sudognu,sudoku,t1lib,t1utils,taglib,tcl,testdisk,texlive_base,texlive_texmf,thunar,tiff,tightvnc,tk,toolame,tor,totem,transcode,transfig,tremor,ufconfig,umfpack,unzip,vim,vlc,vorbis,vte,wavpack,webkit,wget,windowmaker,wmapm,wmcalclock,wmclock,wmcube,wmminichess,wmmixer,wmnet,wmnetload,wmtictactoe,wmtz,wordnet,wpi,wv2,wxWidgets,x11vnc,x264,xawtv,xblast,xcd,xchat,xchm,xcursor,xdg,xemacs,xfce,xfce4,xfconf,xfdesktop,xfig,xfwm4,xmlrpc,xmonad,xosd,xpdf,xsane,xulrunner,xvidcore,xxxterm,xz,yelp,yencode,yt,zenity,zip,zoo
- (607)How to generate a sequence in openBSD?
jot <# values needed> <start value>
e.g., jot 10 50
From: http://www.patpro.net/blog/index.php/2008/12/02/644-jot-et-seq-creer-des-sequences-en-ligne-de-commande/
- (608)How to get the IRQs in use by the devices attached to the PC?
$ vmstat -i
interrupt total rate
irq0/clock 27470521 200
irq0/ipi 33769193 245
irq144/acpi0 1 0
irq145/inteldrm0 144567 1
irq176/azalia0 378904 2
irq112/wpi0 7 0
irq106/bge0 1923025 14
irq96/uhci2 672 0
irq96/ehci1 21 0
irq105/ahci0 852129 6
irq146/pckbc0 27022 0
irq147/pckbc0 889140 6
Total 65455202 476
- (635)What to do if everything typed at the login prompt is in caps?
This is a feature, not a bug, actually.
Hitting CTRL-D at the login prompt will cause getty(8) to terminate, and init(8) will relaunch a new one, which will accept uppercase and lowercase properly.
- (697)How to burn a DVD from commandline?
growisofs -overburn -dry-run -Z /dev/rcd0a -r -J -iso-level 3 /path/to/burn
- (706)Script to automatically mount SMB shares (e.g. sent by mail and clicable in ThB)
#!/usr/local/bin/bash
# USAGE
# ~/open_win_shares '\\dtasac1\DCSI\LIMA\AFIA2011\EvenementGrandPublic'
if [[ x"$#" != x"1" ]]
then
kdialog --error "Error, no shared directory provided! ($# args)"
else
shared_dir="$1"
pass=`kdialog --password "Please enter your SMB@Intra password for $1"`
/usr/local/sbin/shlight "`echo ${shared_dir:7} | tr '\' '/'`" ~/Shares/WinSMB -W INTRA -U gm224627 -P ${pass}
konqueror ~/Shares/WinSMB
fi
# umount ~/Shares/WinSMB/
- (709)How to start FTP server (in OpenBSD only?)?
/usr/libexec/ftpd -A -4 -D -l -l
- (713)Patterns od commands to connect/copy files from home
ssh -X -p 2222 guigui@anasazy.dyndns.org
scp -r -P 2222 guigui@anasazy.dyndns.org:~/ .
- (757)How to configure Grub2?
Configuring GRUB 2
Do the following to configure GRUB 2.
Open the file /etc/grub.d/40_custom with your preferred editor. You will probably need root privileges.
Add the following to the end of the file. This assumes that OpenBSD is installed on the fourth partition of the first hard disk. Adjust the second line if OpenBSD is installed on another partition.
menuentry "OpenBSD" {
set root=(hd0,4)
chainloader +1
}
The GRUB 2 configuration file needs to be regenerated. By default, this file is located in /boot/grub/grub.cfg. Run the following command with root privileges to regenerate it.
# grub-mkconfig -o /boot/grub/grub.cfg
See the GRUB 2 manual for more information about grub-mkconfig.
If you run Ubuntu, however, you should run following command instead of the previous one.
# update-grub
The update-grub command does essentially the same as grub-mkconfig. See the update-grub(8) manual page for more information.
Reboot your machine. An entry named ‘OpenBSD’ should appear in the GRUB menu.
If GRUB 2 fails with the message ‘error: invalid signature’ when you attempt to boot OpenBSD, you should check whether you really specified the correct partition in the configuration file.
From: http://www.kariliq.nl/openbsd/grub2.html
- (759)How to make a backup of the OpenBSD boot loader?
# dd if=/dev/rwd0a of=openbsd.pbr bs=512 count=1
- (795)How to generate One Time Passwords (OTP), S/Key, unique use passwords?
skey, otp-md4, otp-md5, otp-rmd160, otp-sha1
From: http://www.openbsd.org/cgi-bin/man.cgi?query=skey&sektion=1
- (6)File redirection with Bash (thanks to Vroum)
> ou 1> : manages STDOUT
2> : manages STDERR
2>&1 Redirects STDERR to STDOUT
&> Redirects STDERR and STDOUT
- (9)Read line by line instead of token by token in Bash
La bonne manière de faire, dans ce cas précis, est plutôt :
ls | while read f
do
echo "$f"
done
Si la liste est grande, tout est mis en mémoire d'un coup avec une
boucle for, avant même que la boucle ne commence. Avec read, on a
vraiment un traitement ligne par ligne.
- (28)Switch from dir to dir
Sous bash, popd et pushd, permettent de mémoriser des chemins de
répertoires dans une pile, pour se simplifier la vie et éviter de
taper des cd à tout bout de champs. La commande dirs permet de voir
les répertoires actuels du stack.
ca implique qu'on ne peut revenir que dans le sens inverse, pas sauter
au repertoire -2, j'ai bon ?
sinon dans le style y'a "cd -" qui peut être utile
Re: Enchainer les répertoires
Si, on peut aller à n'importe lequel des répertoires (en tous
cas, sous bash) : cd ~n où n est la profondeur dans la
pile. Remarque : ça ne dépile rien, ça remplace juste le top
level.
- (29)Bash security/history
HISTSIZE
The number of commands to remember in the command history (see HISTORY
below). The default value is 500.
HISTFILE
The name of the file in which command history is saved (see HISTORY below).
The default value is ~/.bash_history. If unset, the command history is not
saved when an interactive shell exits.
HISTFILESIZE
The maximum number of lines contained in the history file. When this vari
able is assigned a value, the history file is truncated, if necessary, to
contain no more than that number of lines. The default value is 500. The
history file is also truncated to this size after writing it when an inter
active shell exits.
- (33)Count a word occurences in a file
$ cat fichier | sort | uniq -c
- (71)Get a message repeated until you CTL-C
just type "yes <message>"
- (77)On the use of '*'
- if you ls *, you get all files in the current dir
- if you ls */*, you get all files in all "first-order" subdirs of the current dir
- to list all the files in all the subdirs: ls -R
- with **/* (at least in ant) you get all the files in all the subdirs.
- (81)Reuse arguments from the last command
- for a particular agument, use !:1 !:2 !:3...
e.g., mkdir toto ; cd !:1
- for all arguments, use !:*
- (82)Get number of arguments of a script
- use $#
e.g., if [[ $# != 3 ]]; then ... ;fi
- (83)Doing tests correctly
The [[ ]] construct is the more versatile Bash version of [ ]. This is the extended test command, adopted from ksh88.
No filename expansion or word splitting takes place between [[ and ]], but there is parameter expansion and command substitution.
Using the [[ ... ]] test construct, rather than [ ... ] can prevent many logic errors in scripts. For example, the &&, ||, <, and > operators work within a [[ ]] test, despite giving an error within a [ ] construct.
From the "Advanced Bash Scripting" guide
http://tldp.org/LDP/abs/html/
- (85)Difference between "" and ''
- "" is used to prevent bash from interpreting spaces (therefore grouping words into a single argument), but $ and \ are still a special charaters
e.g.1, in a script, echo "$2" will print the second argument.
e.g.2, "\n" is interpreted as newline
- '' prevents any[1] interpretation, even of the \.
e.g.1, in a script, echo '$2' will print $2, not the content of the second argument.
e.g.2, '\n' is interpreted as the concatenation of '\' and 'n'
Be careful, as '\' is not interpreted, you can have strange results. For instance, '\'' is seen as '+\+'+' since the internal \' is not interpreted, three ' are seen, which leads to an "unbalanced string" error.
[1] The exact truth:
(from the ABS: http://www.tldp.org/LDP/abs/html/quotingvar.html)
DOUBLE QUOTES
When referencing a variable, it is generally advisable to enclose its name in double quotes. This prevents reinterpretation of all special characters within the quoted string -- except $, ` (backquote), and \ (escape) [and !, on the command line]. Keeping $ as a special character within double quotes permits referencing a quoted variable ("$variable"), that is, replacing the variable with its value (see Example 4-1, above).
Use double quotes to prevent word splitting. [2] An argument enclosed in double quotes presents itself as a single word, even if it contains whitespace separators.
SIMPLE QUOTES
Single quotes (' ') operate similarly to double quotes, but do not permit referencing variables, since the special meaning of $ is turned off. Within single quotes, every special character except ' gets interpreted literally. Consider single quotes ("full quoting") to be a stricter method of quoting than double quotes ("partial quoting").
Since even the escape character (\) gets a literal interpretation within single quotes, trying to enclose a single quote within single quotes will not yield the expected result.
- (86)Short script to get a reminder (an xmessage) at a given date & hour
--------------- xrappel
#!/bin/bash
if [[ "$#" -le "1" ]]
then
echo "Usage: $0 [<MM/DD/YY>] <hour:minutes> \"<message>\""
else if [[ "$#" -eq "2" ]]
then
echo 'export DISPLAY=:0.0 ; /usr/bin/xmessage " ************** '$2' ************"' | at "$1"
else
echo 'export DISPLAY=:0.0 ; /usr/bin/xmessage " ************** '$3' ************"' | at "$2" "$1"
fi
fi
- (87)Difference between $* and $@
- $* sees all arguments as single word.
- $@ sees arguments as separate words.
----------------- example script:
index=1
echo "Listing args with \"\$*\":"
for arg in "$*" # Doesn't work properly if "$*" isn't quoted.
do
echo "Arg #$index = $arg"
let "index+=1"
done # $* sees all arguments as single word.
echo "Entire arg list seen as single word."
echo
index=1 # Reset count.
# What happens if you forget to do this?
echo "Listing args with \"\$@\":"
for arg in "$@"
do
echo "Arg #$index = $arg"
let "index+=1"
done # $@ sees arguments as separate words.
echo "Arg list seen as separate words."
from "Advanced Bash Scripting" guide:
http://tldp.org/LDP/abs/html/
- (118)Create a directory hierarchy in one shot
mkdirhier toto/tutu/titi or mkdir -p toto/tutu/titi
It works even if toto and toto/tutu do not exist
- (120)Some useful control keys for the bash
Some commmands from (x)emacs work with bash:
- ESC-t to swap words
- CTL-t to swap characters
- ESC-u to change a word into uppercase
- ESC-l to change a word into lowercase
- ESC-c to capitalize the word
- CTL-r to backwards search in the command history
BE CAREFUL : CTL-S "freeze" xterm (use CTL-q to unfreeze)
- (124)Manage history
- type 'history' to list the last commands
- type '!xxx' to recall the command number xxx
- (175)How to get the user enter a password in a script
echo Enter password:
stty -echo
read passwd
stty echo
mount -t smbfs -ousername=myusername,password=$passwd //192.168.2.5/sharename /mnt/mountname
- (177)How to get the file extension and file name in a script
Using bash there's also ${file%.*} to get the filename without the extension and ${file##*.} to get the extension alone. I.e.
file="thisfile.txt"
echo "filename: ${file%.*}"
echo "extension: ${file##*.}"
outputs:
filename: thisfile
extension: txt
- (195)nohup a running process
Usually nohup is only executed on startup of a command given as argument but cannot attach to a running process.
If you are running your job control in Bash then you could use the built-in disown command like
Code:
$ echo $0
bash
$ sleep 600 &
[1] 5764
$ disown -h %1
Now you should be able to logout without the shell sending a SIGHUP to your disowned sleep job.
May I refer you to man bash:
Code:
disown [-ar] [-h] [jobspec ...]
Without options, each jobspec is removed from the table of
active jobs. If the -h option is given, each jobspec is not
removed from the table, but is marked so that SIGHUP is not sent
to the job if the shell receives a SIGHUP. If no jobspec is
present, and neither the -a nor the -r option is supplied, the
current job is used. If no jobspec is supplied, the -a option
means to remove or mark all jobs; the -r option without a job?
spec argument restricts operation to running jobs. The return
value is 0 unless a jobspec does not specify a valid job.
(from: http://www.unix.com/shell-programming-scripting/79205-stoped-job-using-ctrl-z-now-want-run-nohup.html)
- (204)Getting a random value
Simply use $RANDOM
- (205)Dereferencing a string (a.k.a get the value of a variable for which have the name in a string)
${${var}}
Mixed with arrays, this gives:
A] on the use of @ vs. * to get all args
BAD: ${${tata[1]}[@]}
GOOD: ${${tata[1]}[*]}
B] on the evaluation of the inner string
if ${tata[1]} is in a string $chaine, then we do `eval "expr \"$chaine""`
if tata[1] is in a string $chaine, then we do `eval "expr \"\${$chaine}""`
- (217)Setting bash-like commands (C-a, C-e, C-_, C-k/C-y, etc) on the editing line of bash
either insert in .inputrc:
set emacs on
(or set editing-mode emacs)
or use
set -o emacs on
- (230)How to manage files with accents in their name when XTerm does not support accentuated characters
If you have a file called 'Régles spatiales', you can move it by typing 'mv R(Ctl-v é)gles spatiales xxx'
It can probably work with characters obtained with the MultiKey too.
- (237)How to transpose an array/matrix stored in a file in bash
awk '
{
for (i=1; i<=NF; i++) {
a[NR,i] = $i
}
}
NF>p { p = NF }
END {
for(j=1; j<=p; j++) {
str=a[1,j]
for(i=2; i<=NR; i++){
str=str" "a[i,j];
}
print str
}
}' file
from : http://stackoverflow.com/questions/1729824/transpose-a-file-in-bash
- (301)How to print an integer variable with always X digits?
Use printf:
for i in 1 2 3 4 5 6 ; do printf "%.4d\n" ${i} ; done
- (302)How to get info about any image format (e.g. image size, etc.) from the commandline?
use ImageMagick::identify
- (308)How to format printing of values? (for instance count integers, printing them with always 4 digits: 0000 0001 0002...)
Use "printf":
printf "Pi to 2 decimal places = %1.2f" $PI
echo
printf "Pi to 9 decimal places = %1.9f" $PI # It even rounds off correctly.
- (336)How to shuffle a playlist in commandline?
commande (notez que vous devez installer avant le paquet coreutils pour utiliser shuf) :
cowsay -f $(ls /usr/share/cows | shuf -n1) hello
- (342)How to configure Zsh key binding like it is done with Bash's .inputrc?
Just make a .zshrc file with the same content as the .inputrc, but with each line preceded by "bindkey "
You can convert /etc/inputrc for Zsh:
# bind special keys according to readline configuration
eval "$(sed -n 's/^/bindkey /; s/: / /p' /etc/inputrc)"
From : https://wiki.archlinux.org/index.php/Zsh
- (388)How to run a process only once (if it is not already running)?
"pgrep -f -u <user> -x <prgm> || <prgm>
=> bash function
# This version allow to run programs with arguments :)
function run_only_once()
{
IFS=" " read -a splitted <<< $1
pgrep -u `id -u` -x `basename ${splitted[0]}` || eval ${splitted[*]}
}
- (398)How to source the "profile" files?
Try starting a virtual terminal, and then do
"bash -i"
# or
"bash -".
It should start a login shell and it should source the /etc/profile* files.
- (400)How to generate a sequence?
seq <first> <increment> <last>
seq 2 10
seq 10 -1 2
- (401)How to reverse a string/int?
rev 123456 => 654321
- (489)How to run the last command as root?
sudo !!
- (533)How to find file by size (more/less than xMb/xKb) [not specified in the linux man!]?
find . -maxdepth 1 -size -1000k -name '*.pdf'
find . -maxdepth 1 -size +1M -name '*.pdf'
ATTENTION: the second command does not seem to return the files that the 1rst command returns!
- (534)How to simply set the separator in awk?
echo 'a,b,c' | awk -F',' '{ print $1 }'
- (535)How to print the whole read line in awk?
echo 'this is a test' | awk '{ print $0 }'
- (555)How to see the structure of the file tree in console?
install and use "tree"
- (556)How to see the structure of the processes tree in console?
pstree
- (598)How to create a logout script for ksh?
add "trap '$HOME/.logout' 0" in your ~/.profile
make the ~/.logout executable using: chmod +x ~/.logout
e.g., ~/.logout can simply contain "clear" so that nobody know the last command you typed (security!)
- (626)How to prevent bad editing of a long line when using colors in prompt?
set the following variable in "readline"'s config file (~/.inputrc):
set horizontal-scroll-mode On
From: http://www.math.utah.edu/docs/info/features_7.html#SEC49
- (627)How to prevent counting of color escape chars in PS1 prompt?
You need to "escape" the escape sequences - like this:
export PS1="\[^[[33;1m\]\u@\h\[^[[0m^[[1m\]: "
export PS2="\[^[[33;1m\]continue \[^[[0m^[[1m\]> "
Note: the use of \e has the same effect as a ^[
From: http://www.patoche.org/LTT/shell/00000076.html
- (628)
- (629)How to look for several words at a time in a file?
$ egrep 'WORD1|WORD2|WORD3' seekfile.text
- (768)How to print/echo special chars on command line?
echo "$IFS" | cat -vte
- (769)How to split a string based on a delimiter in bash?
-- using read &while loop
IN="bla@some.com;blo@plop.fr;john@home.com"
IFS=';' read -rsa ADDR <<< "$IN" #Â read options : -r (do not interpret '\') -a (create en array var) -s (silent mode)
for i in "${ADDR[@]}"; do
# process "$i"
echo $i
done
IFS=$OIFS
-- using for loop
IN="bla@some.com;blo@plop.fr;john@home.com"
OIFS=$IFS
IFS=';'
for i in $IN #Â do not enquote $IN with "" or it will not be interpreted!
do
# process "$i"
echo $i
done
IFS=$OIFS
-- with no loop
IN='one;two;three' #Â the input string
OIFS=$IFS # saving the current separator
IFS=';' # setting the new separator
spo_array=($IN) # making bash split the var along the new separator
IFS=$OIFS # re-setting the separator to its old value
for i in 0 1 2 ; do echo ${spo_array[$i]} ; done # showing the result!
-- the one-liner:
IN="bla@some.com;blo@plop.fr;john@home.com"
a="(${IN/;/ })";
From : http://stackoverflow.com/questions/918886/split-string-based-on-delimiter-in-bash
- (770)How to send the content of a variable (instead of the content of a file) as a redirection?
use <<< (resp. <<) instead of << (resp. >>)
- (771)How to work with arrays in bash?
${ADDR[@]} => the whole array, elements separated
${ADDR[*]} => the whole array, elements joined
${ADDR[<n>]} => the nth element
declare -a
read -a
- (772)How to get specific fields of a file in bash (with no sed/awk/perl tricks!)?
while IFS=":" read -r username passwd uid gid info home shell
do
echo "$username:$info"
done < /etc/passwd
From: http://stackoverflow.com/questions/8884935/bash-script-and-greping-with-command-line
- (774)How to make a bash variable save/show the carriage returns?
$ toto=`cat blob | grep ijk`
$ echo $toto # => no carriage return
$ echo "$toto" # => with carriage return
From: http://www.unix.com/shell-programming-scripting/26010-newlines-shell-variables.html
- (779)How to remove the first/last lines of a file in bash?
head -n -9 => remove last lines
tail -n -9 => remove first lines
Be aware the tail starts at the nth line while head skips n lines of the
input.
From:
http://stackoverflow.com/questions/418467/whats-an-easy-way-to-trim-n-lines-from-the-tail-of-a-file-without-the-use-of
- (780)How to remove last character from a string in bash?
x="foo bar"
echo "${x%?}"
From:
http://www.cyberciti.biz/faq/bash-remove-last-character-from-string-line-word/
- (781)How to remove the last empty line with sed?
${/^$/d;} this will only match an empty line if it is the last line of
the file.
From: http://stackoverflow.com/questions/4448826/removing-last-blank-line
- (366)Basic R commands
* Général :
on est en fonctionnel, donc quand on donne une commande, comme order(x), ça renvoie le x trié, il faut le récupérer. De même, quand on donne juste le nom d'une fonction, ça affiche son code.
* Chercher de l'aide sur une commande
help("<command name>")
* Afficher le contenu d'un objet
<nom de l'objet>
print(<nom de l'objet>)
* Spécifier l'encoding à utiliser
encoding("latin1")
encoding("utf8")
* Charger un fichier
read.csv("/path/to/file")
* Fusionner des vecteurs/matrices
cbind(mat,vectcol) : coller vectcol comme dernière? colonne de mat
rbind(mat,vectligne) : coller vectcol comme dernière? ligne de mat
merge(mat,mat) : équivalent d'un join en BD : fusionne deux dataframes en fonction d'une ou plusieurs lignes (resp. colonnes) si fusion pas possible (ex: pas de valeur commune?) renvoie toutes les combinaisons des valeurs présentes.
* Connaître les dimensions d'un objet
dim(objet) <-> dimension 2 (matrice, table, dataframe)
length(objet) <-> dimension 1 (vecteur)
* Connaître les noms des colonnes d'un objet
dimnames(objet) <-> tables
colnames(objet) <-> matrices?
names(objet) <-> dataframes?
* Différence entre vecteur/liste/table/matrice/dataframe, etc.
- Vecteur = Liste ? = dimension 1
- Table = résultat de table(), composé d'une ligne de names et une ligne de valeurs
- Matrice = que des nombres ?
- dataframe = dimension 2, avec éléments de types différents, infos supplémentaires (colnames, etc.)
* Récupérer des infos sur un objet
summary(objet) : renvoie qq analyses stats sur le dataframe
head(objet) : affiche les premières ligne d'un objet
* Compter les occurence d'élements
table(objet)
* Supprimer les doublons / récupérer la liste des éléments qui apparaîssent dans l'ensemble des données
unique(dataframe$colonnes)
* Chercher les éléments communs entre deux vercteurs/etc.
match(a,b) : si trouve a dans b, retourne les indices des a dans b
intersect(a,b) : renvoie
* Trier un vecteur/matrice
sort(vector) : renvoie le vecteur trié
order(x) : renvoie un vecteur donnant la liste de permutations à opérer pour trier l'objet (vecteur d'indices des éléments dans l'objet original)
* Concaténer des chaînes de caractères
paste(deb,fin)
* Faire des itérations
for (x in <vector>) { ... }
ATTENTION en R on peut éviter des boucles en faisant une utilisation intelligente des [] : <dataframe>[order()]
* Récupérer des sous-éléments d'un dataframe
data[<contraintes sur les ligne>,<contraintes sur les colonnes>]
<dataframe>$ColName == <dataframe>["ColName"]
X[-1,] récupère tout sauf la première ligne
X[,-1] récupère tout sauf la première colonne
ATTENTION en dimension 2, utiliser <dataframe>["ColName",] pour récupérer un élément de dimension 2 et non un vecteur
X[[1]] renvoie le premier élément d'une liste.
* Enlever les NA / remplacer les NA par des 0 (="not available")
data[!is.na(data),] <- 0
* Do a logical AND or OR between vector values: BE CAREFUL!!! The && will generally not do what you want:
'&' and '&&' indicate logical AND and '|' and '||' indicate
logical OR. The shorter form performs elementwise comparisons in
much the same way as arithmetic operators. The longer form
evaluates left to right examining only the first element of each
vector. Evaluation proceeds only until the result is determined.
The longer form is appropriate for programming control-flow and
typically preferred in 'if' clauses.
* Parcourrir un répertoire
fileNames = system("ls <dirname>",intern=T) # or fileNames = list.files() ;
for (i in fileNames) { ... }
* Appliquer une fonction (ici, sum) sur une matrice
X <- apply(Y, 1, sum) # "1" <=> work line by line, "2" <=> work column by column
* Dessiner / Plotter les données
plot(A$Col1, B$Col2) # plot(x, y) : met des points à (x=Col1 de A, y=Col2 de B)
* Mettre plusieurs dessins les uns à côté des autres
oldpar <- par(mfcol=c(2,2),cex=.5) # 1. saves plot config / 2. configures a 2*2 matrix of independent plots
plot(...) # first plot
plot(...) # second plot
plot(...) # ...
par <- oldpar
* Mettre plusieurs dessins les uns sur les autres
points()
plot(A$Col1 ~ B$Col2) # plot("y en fonction de x") : plot Col1 de A (y) en fonction de Col2 de B (x)
* Get the length of a string
nchar(str)
* From: http://www.childrensmercy.org/stats/weblog2005/StringsR.asp
* paste() combines several strings together into a single string.
* substr() selects substrings.
* format() makes a set of numbers print out more nicely.
* chartr() converts specific characters in a string to different characters.
* tolower() converts all the letters in a string to lower case.
* toupper() converts all the letters in a string to upper case.
* casefold() will perform either of the two conversions shown above.
* a %in% b returns a logical value of TRUE for each value of a which can be found somewhere in list b and FALSE if that value cannot be found.
* pmatch(), match(), charmatch() work similarly but with subtle variations.
* grep() searches for matches to a pattern.
* strsplit() splits a string into several pieces.
* makeUnique() is found in the limma package and adds numbers to the ends of duplicate strings to give each one a unique name.
* trimWhiteSpace() is found in the limma package and removes leading and trailing blanks from a string.
* Manipulation de fichiers
help(dir) => dir.create()
help(file) => basename()/dirname() pour manipuler les noms de fichiers
* Comment faire retourner deux valeurs à une fonction ?
le plus sûr est d'utiliser une list; si on utilise des vectors, le resultat est *un unique* vector plutôt qu'une collection de
deux vectors. Generic pattern :
maFonction <- function() {
a <- 1
b <- 3
list(un=a,trois=b)
}
nombres=maFonction()
nombres$un
nombres$trois
* Comment mettre en forme des entiers (ex: imprimer des zeros devant pour avoir toujours le même nombre de caractères)
olddata$NUMFUA <- sprintf("%019.0f",olddata$NUMFUA)
* Comment dessiner un scatterplot (groupe de plot comparant des attributs 2 à 2)
pairs(<dataframe>)
* Comment sortir les graphiques dans des fichiers pdf ou png?
pdf("<nomfichier>.pdf") ;
<instructions graphiques>
dev.off() ;
* Comment libérer de la mémoire
delete.all <- function() { rm(list=ls(pos=.GlobalEnv), pos=.GlobalEnv) }
delete.all()
graphics.off()
From: http://snipplr.com/view/4013/r-clean-workspace
- (373)Functions to work on Strings
nchar(unqoldnumvol) : nb chars.
http://www.childrensmercy.org/stats/weblog2005/StringsR.asp
As part of my efforts to analyze microarray data, I am finding that I need to do simple string manipulations in R. Here is a list of functions that might help.
* paste() combines several strings together into a single string.
* substr() selects substrings.
* format() makes a set of numbers print out more nicely.
There are several functions that will convert one string into another string.
* chartr() converts specific characters in a string to different characters.
* tolower() converts all the letters in a string to lower case.
* toupper() converts all the letters in a string to upper case.
* casefold() will perform either of the two conversions shown above.
Several functions help find matches between two lists.
* a %in% b returns a logical value of TRUE for each value of a which can be found somewhere in list b and FALSE if that value cannot be found.
* pmatch(), match(), charmatch() work similarly but with subtle variations.
Several functions will use regular expressions.
* grep() searches for matches to a pattern.
* strsplit() splits a string into several pieces.
A nice tutorial, by the way, on regular expressions is at:
* en.wikibooks.org/wiki/Programming:Perl_Regular_expressions
There are several string manipulation functions found in the limma package, including
* makeUnique() is found in the limma package and adds numbers to the ends of duplicate strings to give each one a unique name.
* trimWhiteSpace() is found in the limma package and removes leading and trailing blanks from a string.
- (374)How to print ints with a predifined number of digits?
olddata$NUMFUA <- sprintf("%019.0f",olddata$NUMFUA)
print ints with leading 0's
- (375)Funtions to work on files/directories
help(dir) => dir.create()
help(file) => basename/dirname pour les noms de fichiers
- (376)How can I return two values in a function?
safer to wrap the results into a list; if both foo and bar are vectors,
the returned result would be *one* vector rather that a collection of
two vectors. so the generic pattern would be:
<function> = function(<args>) {
<body>
list(<values>)
}
?return
- (424)How to change the range of the plots?
xlim, ylim
- (425)How to search for the position of a value in a vector?
- match()
- which()
- (a)grep()
- (426)How to remove doubles in a vector? [Hack]
unique(match(v,v)) ;
- (427)How to know how to use a given function? Get examples of use?
example(<funname>) ;
- (428)Beware of the recycling rule of R
When two vector of the same size are expected and R gets 2 vectors of different sizes, it concatenates the shortest one several time until it gets the same size as the longest one. E.g.:
> c(1,2,3) + c(1,2,3,4,5)
[1] 2 4 6 5 7
which is indeed:
> c(1,2,3,1,2) + c(1,2,3,4,5)
- (429)How to select all elements that are above 95% or below 5%?
v[(v<quantile(v,.05))|(v>quantile(v,0.95))]
- (430)How to select all elements that are within mean+/-2*sd?
v[abs(v-mean(v))>2*sd(v)]
- (431)How to know if a vector contains a certain value?
- any(v==TRUE)
- all(v==TRUE)
- %in%
- (432)How to create sequences?
use 'rep()' or 'seq()' or ':' if appropriate
- (433)How to know the class/type of an object?
- use class() or mode()
- For Gtk objects (that can be polymorphic, i.e. belong to several classes),
DO NOT use:
if (class(obj)==GtkXXX) {}
but
if (is(obj,"GtkXXX")) {}
- (434)How to access Hidden variables?
- Hidden variables are those that start with a "."
- to list them, use ls(all.names=TRUE) ;
- (435)How to get informations on the currently defined variables?
ls.str() ;
- (436)What is the difference between print/cat?
- 'print()' can print almost any element (even composed ones)
- 'print()' cannot print several elements at once (=> need to use 'paste()')
- 'cat()' can print only basic object types
- 'cat()' can print several elements in a continuous output
- (437)On the use of &/&& and |/||
~&~ and ~&&~ indicate logical AND and ~|~ and ~||~ indicate logical
OR.
The shorter form performs elementwise comparisons in much the same way
as arithmetic operators.
The longer form evaluates left to right examining only the first
element of each vector. Evaluation proceeds only until the result is
determined.
The longer form is appropriate for programming control-flow and
typically preferred in ~if~ clauses.
- (438)How to access list elements?
mylist[i:j] returns a list of several elements, the ones from positions i to j
mylist[[i]] returns /the element/ at position i
- (439)How to get an ascii representation of your data?
dump() ;
- (440)How to find a suitable package for a certain task?
- List of packages by domain: http://cran.r-project.org/web/views/
- List of packages ordered alphabetically: http://cran.r-project.org/web/packages/
- (441)How to get even more help?
- install.packages("sos") ;
- RSiteSearch("topic") ;
- vignette(package="packagename") ;
- http://crantastic.org/ http://rseek.org/
- (442)How to make Java/rJava not circumvent R's environment variables? [Linux only]
Create a ~/.Renviron file with the following lines:
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
- (443)How to get line numbers from a data.frame?
data$NUMBER <- row.names(data) ;
- (444)How to compare objects in if/while statements in R?
From "?identical":
A call to ~identical~ is the way to test exact equality in ~if~
and ~while~ statements, as well as in logical expressions that use
~&&~ or ~||~. In all these applications you need to be assured of
getting a single logical value.
Users often use the comparison operators, such as ~==~ or ~!=~, in
these situations. It looks natural, but it is not what these
operators are designed to do in R.
- (445)How to print the elements of a vector/list in a sigle line?
print(paste("value=",vector,collapse=',')) ;
- (446)Remove elements from a vector (!! probably also removes doubles !!!)
# Returns vector cols, with elements of vector "colsToRemove" removed
removeElements <- function(eltsToRemove, elts)
{
return(setdiff(elts, eltsToRemove)) ;
}
- (447)How to connect to an oracle DB?
library(RJDBC);
drv <- JDBC("oracle.jdbc.OracleDriver",
"/home/gmuller/ojdbc14.jar",
identifier.quote="`");
conn <- dbConnect(drv, "jdbc:oracle:thin:@<db server ip>:1521:<sid>", "<username>", "<password>");
dbGetQuery(conn, "SELECT * from BD_NAME") ;
- (448)Pièges classiques
-> Variables "XXX" définie dans l'environnement global et utilisée par erreur à la place d'une variable locale "XXXs" à l'intérieur d'une function
-> Boucle for(i in 1:ncol(X)-1) [le -1 s'applique à tout le vecteur 1:Y ! Ce dernier commence donc à 0!] au lieu de for(i in 1:(ncol(X)-1))
-> colnames(varThatDoNotExist) => c() au lieu d'une erreur dans une function ???
-> Use mydata[mydata$X=="Y"] (returns a vector) instead of mydata[mydata$X=="Y",] (returns a data.frame)
-> ifelse(TRUE,c(1,2,3),5) reutrns only 1, because ifelse(c(x,y,z),c(1,2,3),c(-1,-2,-3)) returns 1/-1 if x==TRUE/FALSE , 2/-2 if y==TRUE/FALSE and 3/-3 if x==TRUE/FALSE
-> x < - y+1 (with a space between '<' and '-') => computes "x is inferior to -y+1" instead of "affecting y+1 to x"
- DO NOT use: if (class(obj)==GtkXXX) {} (particularly with Gtk objects, since they can be polymorphic, i.e. belong to several classes), rather use if (is(obj,"GtkXXX")) {}
- (449)Coding style
-> When writing on several lines, it's better to write them like that:
plop <- a+b+c+
d+e+f
rather than:
plop <- a+b+c
+d+e+f
because in the first case R is forced to see that the line is not terminated. In the second case, it could happen that R considers the first line terminated, so the computation is erroneous AND the second line is erroneous
- (450)How to make a GUI? - 1
1. use library("Rgtk2")
2. make the gui with glade and save it in the GtkBuilder format
3. load the GUI in R with
# Initializes an GLOBAL object to load a GUI built with Glade
myGUI <- gtkBuilderNew() ;
# Load the XML file generated by Glade
gtkBuilderAddFromFile(myGUI, "path/to/glade/xml/file") ;
# Connect the signals listed in the builder XML file
gtkBuilderConnectSignals(myGUI) ;
4. you can access the various object composing the GUI with
obj1 <- gtkBuilderGetObject(guiObject, "component ID/name") ; # NOTE: Gave names/ids to the objects in glade!
- (451)How to make a GUI? - 2 [EASIER!]
install.packages("gWidgetsRGtk2", dep=TRUE) ;
require("gWidgets") ;
options("guiToolkit"="RGtk2") ;
And then have a look at:
http://cran.r-project.org/web/packages/gWidgets/vignettes/gWidgets.pdf
to understand how to use it
- (452)How to make a GUI? - 3
- Je conçois l'interface avec glade (apparemment il marche sur windows
aussi, reste "juste" à connecter les signaux, mais c'est très facile en
R puisqu'il suffit de donner le nom de la fonction de CallBack) :
http://glade.gnome.org/
Le fichier XML résultant de l'utilisation de Glade décrit la GUI et
peut être chargé grâce à un objet GtkBuilder de RGtk2.
- Je code le reste en RGtk2 :
http://www.ggobi.org/rgtk2/ (c'est le site de base, mais il n'y a pas
beaucoup de documentation, juste quelques exemples...)
http://www.jstatsoft.org/v37/i08/paper (un papier avec quelques
exemples, très clair mais pas très complet)
http://rss.acs.unt.edu/Rdoc/library/RGtk2/html/ (j'utilise cette doc
HTML plutôt que la version locale incluse dans R, car les liens
hypertexte sont bien pratique pour se balader dans la structure assez
complexe des types de Gtk)
- J'utilise pas mal la doc de pyGTk, qui est beaucoup plus complète que
celle de RGtk2 :
http://www.pygtk.org/pygtk2tutorial/ (il faut jongler un peu avec le
langage qui est assez différent, mais au moins ça donne les principes à
suivre, des fonctions à appeler et des événements à intercepter. Par
exemple, pour récupérer la valeur selectionnée dans une combobox, je
n'ai trouvé que dans cette doc)
Il y a aussi le code de RGtk2gWidgets qui peut aider à comprendre les
différentes fonction/events
Pour info, RGtk2 utilise les principes de Programmation Orientée Objet
(POO) en R, mais avec le package OOP, pas les S3 et S4 de base du
langage [les docs pour S3 et S4 sont accessibles à ?Classes et
?Method]. Une très bonne doc sur la POO en R se trouve dans le
chapitre 10 de "R in a Nutshell". Et pour le package OOP plus
particulièrement l'appendix E de "Using R for introductory
Statistics".
Sinon, en cherchant comment faire des interfaces graphiques en R,
j'avais aussi vu Tcl/Tk et gWidgets. Si je devais recommencer une
interface de zéro, je pense que c'est gWidgets que j'utiliserais, car
l'API est super simple (malheureusement on ne peut pas utiliser glade
avec cette API).
Sinon mes bouquins de référence sont :
- "The R book"
- "R in a Nutshell"
- "R Cookbook"
- (453)How to use a GtkSpinButton?
A RGtk2::SpinButton does work only if a GtkAdjustment is associated to it (RTFM !!!)
- (454)How to change a global variable from within a function?
To store a value into a global variable, even from within a function, you have to use "<<-" instead of "<-"
- (455)If you get the following error in R:
"Error in asCairoDevice(graphics) : Graphics API version mismatch"
Then remove any Gtk2/cairoDevice package installed and install them /directly within R/, using:
> install.package("RGtk2") ;
> install.package("cairoDevice") ;
- (456)If you get the following error using RGtk2+cairoDevice:
"Error in plot.new() : figure margins too large "
Just make so that your GtkDrawingArea is of squared dimensions (e.g. 800x800). Eventually, put it inside a GtkScrolledWindow (and therefore, you'll need to put a GtkViewPort inside the GtkScrolledWindow before adding the GtkDrawingArea :))
- (457)How to get an object by name?
use:
> get("objectname") ;
- (458)How to get the signature of a function?
use:
> args(<function>) ;
- (459)How to see the code a a hidden function?
use getAnywhere(...) ;
- (460)How to do OOP in R?
- ?Methods
- list classes : getClasses(...)
- definition (S4) : setClass(...)/setMethod(...)/setValidity(...)/
- creation of an instance : new() ;
- list methods : methods("classname") ; / getMethods(...)
- access slots : object@slot
- inheritance : use the 'contains=' argument in setClass(...)
also see the "OOP" package
- (461)Dirty way to force an rbind on 2 dataframes with != colnames
> t(dataframe(t(a),t(b))) ;
Indeed, on some cases, I got this strange error:
> rbind(myDataFrame,matrix(ncol=6,nrow=3))
Error in match.names(clabs, names(xi)) :
names do not match previous names
- (462)How to know the RAM size used by an object?
object.size(a) ;
- (463)How to clean (all) the objects created by the user?
rm(list=ls()) ;
- (464)How to initialize a data.frame?
> df <- data.frame(matrix(ncol = 300, nrow = 100))
> dim(df)
[1] 100 300
From: http://stackoverflow.com/questions/4868903/r-initializing-data-frames
- (465)How to make GUIs in R?
library(RGtk2) or library(RGtkGen)
- (466)How to load a library?
library("<library name>")
- (467)You can get more details on the previous error by typing (right after the error)
traceback() ;
From: http://r.789695.n4.nabble.com/Package-mice-Error-in-if-meth-j-quot-quot-argument-is-of-length-zero-td3437515.html
- (468)"Error in if (...) { : argument is of length zero"
The 'if' returns a vector of length zero when it does not match => do not test with NULL, but if the length is 0:
if (length(...) != 0)
or use is.null()
From: http://r.789695.n4.nabble.com/argument-is-of-length-zero-td1589995.html
- (469)How to correct the body of a funtion after defining the function?
> fix(<funciton name>)
> edit(<funciton name>)
=> will edit the function body in the default $EDITOR
- (503)How to work with switches and strings?
y <- "fruit" ;
switch(y, fruit = "banana", vegetable = "broccoli", "Neither") ;
[1] "banana"
BUT:
To choose from a list of alternatives that already exists switch may
not be the best way to select one for evaluation. It is often better
to use eval and the subset operator, [[, directly via
eval(x[[condition]]).
- (504)How to recover string values from a list of factors numbers?
> levels(<column of factors>)[<list of indices>]
> df <- data.frame(c=c("a","b","b","a"))
> df
c
1 a
2 b
3 b
4 a
> df$c
[1] a b b a
Levels: a b
> levels(df$c)
[1] "a" "b"
> levels(df$c)[df]
Error in levels(df$c)[df] : invalid subscript type 'list'
> levels(df$c)[df$c]
[1] "a" "b" "b" "a"
- (505)How to list last typed commands?
history(100) ;
history(Inf) ;
- (506)How to save the whole workspace?
save.image() ;
- (507)"Error in nchar(ID) : invalid multibyte string ...")
Use
Sys.setlocale()
to fix this.
From: http://www.mail-archive.com/r-help@r-project.org/msg100579.html
- (508)Where does the Warning message: "In ... : Coercing LHS to a list" come from?
LHS = left hand side
- (509)Another way to get the args list passed to a method (particularly useful when using '...' - ellipsed args)
~match.call~ returns a call in which all of the specified arguments are specified by their full names.
- (510)How to compute modulo and quotient of integers?
> 19%%5 % modulo
[1] 4
> 19%/%5 % quotient
[1] 3
- (511)How to remove columns from a dataframe using their name, not their number?
dataEngine=dataEngine[,-match(c(<colnames to remove>),colnames(dataEngine))]
- (512)How to save the content of a gtkDrawable into a file?
see RGtk2::gdk-Pixbufs and RGtk2::gdkPixbufGetFromDrawable
From: http://stackoverflow.com/questions/3254499/save-gtk-drawingarea-to-file
def get_picture(self, event, data):
drawable = self.movie_window.window
colormap = drawable.get_colormap()
pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8, *drawable.get_size())
pixbuf = pixbuf.get_from_drawable(drawable, colormap, 0,0,0,0, *drawable.get_size())
pixbuf.save(r'somefile.png', 'png')
pixbuf.save(r'somefile.jpeg', 'jpeg')
(see also tip 540)
- (513)How to call a function passing it a list as its args instead of the args directly?
?do.call
https://webcache.googleusercontent.com/search?q=cache:uvtZzcrg8-IJ:https://stat.ethz.ch/pipermail/r-help/2002-November/027004.html+&cd=2&hl=en&ct=clnk
- (514)How to pretty-print a list?
noquote(unlist(format(.Machine)))
- (515)How to change float precision? How to resolve (some) errors with float precision?
> abs(1-1.1)<=1
[1] FALSE
> ?as.single
> ?writeBin
> .changePrecision()?
http://r.789695.n4.nabble.com/floating-point-in-single-precision-td2269833.html
--- also see .Machine$double.eps (which is an equivalent of MatLab
eps()) and represents "Machine epsilon mach , i.e. difference between
1 and the next largest double-precision floating-point number.
- (516)Error: "Attempt to apply non-function"?
Happens when object$funName() where object == NULL
- (517)How to activate a Gtk2::SpinButton?
set a GtkAdjument AND set a default value
- (518)RGtk2 callback functions
The callback funtions MUST return FLASE/TRUE (why???when???)
- (519)How to catch an error?
use error <- try() + stop() to intercept the error
E.g.:
x <- 1:100
y <- sqrt(1:100)
postscript("filename", horizontal=FALSE, onefile=FALSE, paper="special",bg="white", family="ComputerModern", pointsize=10);
par(mar=c(5, 4, 0, 0) + 0.1);
err <- try(plot(x, y)) ;
class(err) ;
if (is(err,"try-error")) { stop(paste(err)) } ; # use inherits(err,"try-error")?
dev.off() ;
=> Error in plot.new() : figure margins too large
----
Correct catch of a try-error?
err <- try ( XXX )
if (!is.null(err$error))
{ stop(err$error) ; }
- (520)How to get the result/value of last expression?
x <- .Last.value
but be careful, any new command will re-set its value!
- (521)How to know which packages are currently loaded? How to know where R seeks for functions?
search() ;
- (522)How to list all installed packages?
library() ;
rownames(installed.packages()) ;
- (523)How to install a package?
install.packages("<package name>") ;
- (524)How to unload/detach a package?
detach(package:MASS) ;
- (525)How to list built-in datasets?
data() ;
- (526)How to load built-in datasets?
data(<data set name>, package=<package name>) ;
- (527)How to fix the CRAN mirror to use?
add:
options(repos="URL of the repository")
in your ~/.Rprofile
To get the URL, use chooseCRANmirror() ; options("repos")[[1]][1]
- (528)How to mix R and C?
$ R CMD SHLIB myfile.c
<creates a myfile.so>
$ R
> dyn.load("myfile.so") ;
- (529)How to skip the splash-screen?
run:
$ R --quiet
instead of:
$ R
or make an alias
- (539)How to change the # of columns of the text of the terminal used by R?
wideScreen <- function(howWide=Sys.getenv("COLUMNS")) {
options(width=as.integer(howWide))
}
--- or better:
wideScreen <- function(howWide=system("stty -a | head -n 1 | awk '{print $7}' | sed 's/;//'", intern=T)) # Sys.getenv("COLUMNS")
{
print(paste("Setting column width to ",howWide)) ;
options(width=as.integer(howWide))
} ;
wideScreen() ; # remove this line to make install.packages() work again
From: http://stackoverflow.com/questions/1172485/how-to-increase-the-number-of-columns-using-r-in-linux
- (540)How to save a plot even if the function to draw it is lost?
dev.copy(<format:png,pdf,...>,file="<filename>") ;
dev.off() ;
(see also tip 512)
- (541)How to create an empty data.frame with names for columns?
nbCols <- 20
df <- data.frame(matrix(nrow=0,ncol=nbCols)) ;
colnames(df) <- rep("toto", nbCols) ;
- (542)How to load only some cols in a csv file?
read.csv("rec05784.csv", colClasses=c(rep(NA,30),rep('NULL',200))))
NA => Column is Kept ?
NULL => Column is NOT Kept ?
Possible values are ~NA~ (the default, when ~type.convert~ is
used), ~"NULL"~ (when the column is skipped), one of the
atomic vector classes (logical, integer, numeric, complex,
character, raw), or ~"factor"~, ~"Date"~ or ~"POSIXct"~.
Otherwise there needs to be an ~as~ method (from package
~methods~) for conversion from ~"character"~ to the specified
formal class.
Note that ~colClasses~ is specified per column (not per
variable) and so includes the column of row names (if any).
- (543)How to skip a lines at the start of a CSV?
read.csv("filename", skip=5)
- (544)How to skip a lines at the end of a CSV?
tip: read only X first lines <=> read n-X lines where n is the total number of lines of the file
read.csv("filename", nrows=5) # read only the 5 first lines of the file
- (545)How to run scripts in batch mode?
$ R CMD BATCH myscript.R myscript.Rout
- CMD BATCH automatically captures warnings and errors
- CMD BATCH automatically adds a call to proc.time() at the end of the session, to document how long the script took to run.
From: http://blog.revolutionanalytics.com/2009/06/running-scripts-with-r-cmd-batch.html
- (546)How to concatenate rows/cols quickly (typical use: load multiple csv file to make only one)?
df <- do.call("rbind", listOfDataFrames)
df <- rbind.fill(listOfDataFrames)
df <- ldply(listOfDataFrames, data.frame)
My guess is that using do.call("rbind", ...) is going to be the fastest approach that you will find unless you can do something like (a) use a matrices instead of a data.frames and (b) preallocate the final matrix and assign to it rather than growing it.
From: http://stackoverflow.com/questions/2851327/r-converting-a-list-of-data-frames-into-one-data-frame
- (547)How to get the int value of a factor?
Use as.numeric()
R> df <- data.frame(plop=c("a","a","a","b","b","c"))
R> class(df$plop)
[1] "factor"
R> as.numeric(df$plop)
[1] 1 1 1 2 2 3
- (548)How to get the string value of a factor?
Use paste() or levels()
R> df <- data.frame(plop=c("a","a","a","b","b","c"))
R> class(df$plop)
[1] "factor"
R> levels(df$plop)
[1] "a" "b" "c"
R> paste(df$plop[1]) # When you have the factor itself
[1] "a"
R> levels(df$plop)[1] # When you know the factor value
[1] "a"
- (557)How to make interactive graphics?
use package "Rgoobi" or "iplots" (needs rJava)
http://www.rforge.net/doc/packages/iplots/html/00Index.html
http://www.statmethods.net/advgraphs/interactive.html
- (558)How to generate color palettes?
use package "grDevices"
?heat.colors
?rainbow
?terrain.colors
?cm.colors
?topo.colors
?gray.colors
Define your own palette:
rgb.palette <- colorRampPalette(c("red", "orange", "blue"), space = "rgb")
filled.contour(m, col = rgb.palette(20))
- (559)How to make a (text/tk/win) progress bar
total <- 20
# create progress bar
pb <- txtProgressBar(min = 0, max = total, style = 3)
for(i in 1:total){
Sys.sleep(0.1)
# update progress bar
setTxtProgressBar(pb, i)
}
close(pb)
- (560)A gui for R?
R --gui=<GNOME,tk,X11>
- (561)My ~/.Rprofile with date + color in the prompt + setting of terminal width for prints
# Skip banner
options(quiet=TRUE) ;
# Prevent the printing of "+" when R waits for new input => allows copy/paste
# from R to $EDITOR
options(continue=" ") ;
# Set the default repository to be Lyon1 + Adds AiRPX repository
options(repos=c("http://cran.univ-lyon1.fr", "http://rditairpx/R-packages/")) ;
# Set width and add date+color to the prompt
updatePrompt <- function(...)
{
# Add Time + Colors
options(menu.graphics=FALSE,
prompt=paste("[01;32m", format(Sys.time(),"%H:%M:%S"), "R > [00m")) ;
# Get current # of columns in the term
howWide <- system("stty -a | head -n 1 | awk '{print $7}' | sed 's/;//'", intern=T) ;
options(width=as.integer(howWide)) ;
return(invisible(TRUE)) ;
}
updatePrompt() ;
invisible(addTaskCallback(updatePrompt)) ;
- (657)How to get user input?
cat("\n","Enter x","\n") # prompt
y<-scan(n=1)
prompts for user imput and scans 1 line from console.
~readChar~ and ~readBin~ to read fixed or variable length
character strings or binary representations of numbers a few at a
time from a connection.
readline(), readLines() and scan()
- (638)How to make a plotting window of a specified size?
plot(1:10)
dev.new(width=5, height=4)
plot(1:20)
- (639)How to make formulae work inside functions?
plop <- function(mydata)
{
model <- as.formula("mydata$y ~ mydata$x", env=new.env()) ;
}
- (640)Useful packages
- reshape2
- datatable
- (641)How to find the *index* of the min/max of a vector (in 1 pass)?
which.min(x)
which.max(x)
Determines the location, i.e., index of the (first) minimum or maximum of a numeric vector.
- (642)Roxygen parameters
#' @param
#' @return
#' @keywords
#' @seealso \code{\link{<funcname>}}
#' @export
#' @examples
- (643)How to generate datasets for clustering/classification?
rFace for generation of example data, see below.
- (644)How to prevent a small dataframe to be converted to another type?
oneSetParam <- as.list(allCombiParam[i,,drop=FALSE]) ;
- (645)How to transform numeric values into chars/strings?
R > as.character(list(1,2,3))
[1] "1" "2" "3"
R > paste(list(1,2,3), collapse=" ")
[1] "1 2 3"
- (646)How to access private/hidden functions of packages?
Use ':::'
e.g.,
RWeka:::Weka_packages_loaded()
- (647)How to install rJava?
- make sure you don't have JAVA_HOME set in your environment or set it to the correct JVM.
- set the correct default JVM for your OS: update-alternatives --config java
- run R CMD javareconf
- run R & install.packages("rJava")
- (648)How to know if a variable exists?
exists("<var name>") ;
- (649)How to draw line segments?
use segments()
- (650)How to draw a dotted/dashed line?
use lty=3 resp. lty=2 (see ?par)
- (651)How to make the GUI/core of the program work asynchronously/work in another thread?
Release control to the GUI from the core of the program using:
while (gtkEventsPending()>0)
{ gtkMainIteration() ; }
- (652)How to check if an argument has been provided?
Clean way: use the missing() function:
test <- function(a,b)
{
if (missing(b))
{ return(a) ; }
else
{ return(b) ; }
}
R> test(a=1,b=NULL)
NULL
R> test(a=1,b=2)
[1] 2
R> test(a=1)
[1] 1
Dirty way: set the default value of the argument to NULL and check if it is NULL:
test <- function(a,b=NULL)
{
if (is.null(b))
{ return(a) ; }
else
{ return(b) ; }
}
R> test(a=1,b=NULL)
[1] 1
R> test(a=1,b=2)
[1] 2
R> test(a=1)
[1] 1
- (653)How to load/source a file that itself loads/sources files? [irrelevant for packages]
source('../../other_path/file.R', chdir=TRUE) ; # where file.R loads files in its own directory
or
oldpath <- getwd() ;
setwd("path_to_other_code") ;
source("the_file_to_load") ;
setwd(oldpath) ;
- (654)How to make R/rJava be able to load libjvm?
- set $JAVA_HOME to where your
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.10
- reconfigure R's way to find java (as root?)
# R CMD javareconf
- (655)rJava works for root but not for user sean?
Make sure you don't have JAVA_HOME set in your environment for user sean.
From: https://stat.ethz.ch/pipermail/r-sig-debian/2010-March/001066.html
i.e. the root (the installer of the package) and user (the user of the package) must have the same Java configuration
Also have a look at [How to make R/rJava be able to load libjvm?]
- (656)How to store/load in binary format (a.k.a. accelarate loading of data)?
Use readRDS/saveRDS
or dput/dget or save/load or serialize/unserialize
- (658)How to get user input with no echo (a.k.a. how to read a password)?
get_password <- function()
{
cat("Password: ") ;
system("stty -echo") ;
a <- readline() ;
system("stty echo") ;
cat("\n") ;
return(a) ;
}
> a <- get_password()
Password:
> a
[1] "sdfs"
- (659)How to print formatted doubles/integers?
R> sprintf("%.4d", 2)
[1] "0002"
- (660)How to plot on top of an older plot rather than redrawing?
plot(...) ;
par(new=TRUE) ;
plot(...) ;
Be careful to have the same limits on the axes. Use xlim/ylim
- (661)How to do a rbind more quickly?
Use plyr::rbind.fill
- (662)How to decompose the phases of a plot?
plot.new() ; # creation of the window?
plot.window(xlim=c(minX,maxX),ylim=c(minY,maxY)) ; # Cretation of the drawing canevas?
axis(1) ; # Below axis
axis(2) ; # Left axis
lines(X, Y, col="blue", type="points") ;
- (663)How to print a contingency table of the counts at each combination of factor levels? (a.k.a. matrice de confusion)
table(prediction,iris$Species)
- (664)How to generate all combinations of parameters?
expand.grid(list(A=1:2,B=2:5))
A B
1 1 2
2 2 2
3 1 3
4 2 3
5 1 4
6 2 4
7 1 5
8 2 5
- (665)How to build a dataframe that shows statistics on subsets of an original dataframe?
?aggregate
Splits the data into subsets, computes summary statistics for
each, and returns the result in a convenient form.
e.g., we have a dataframe that lists performance evaluations of the
application of several clustering algos on various test files and we
want the means of the performance of each algorithm on the overall set
of test files
- (666)How to manage lists of lists?
clusters <- list() ;
clusters <- c(clusters, list(clust)) ;
- (667)How to remove annoying outputs (a.k.a. redirect error messages)?
?invisible
or
sink("/dev/null") ;
a <- list_Weka_interfaces()[[category]] ;
sink() ;
or
?capture.output
- (668)How to compute all the combinations/permutations of elements of a vector?
R> ?gtools::combinations
R> library(gtools)
R> combinations(3,2,letters[1:3])
[,1] [,2]
[1,] "a" "b"
[2,] "a" "c"
[3,] "b" "c"
R> permutations(3,2,letters[1:3])
[,1] [,2]
[1,] "a" "b"
[2,] "a" "c"
[3,] "b" "a"
[4,] "b" "c"
[5,] "c" "a"
[6,] "c" "b"
- (669)How to show all the possible graphical point types? (pch)
In ?points, there are examples like the following:
pchShow <-
function(extras = c("*",".", "o","O","0","+","-","|","%","#"),
cex = 3, ## good for both .Device=="postscript" and "x11"
col = "red3", bg = "gold", coltext = "brown", cextext = 1.2,
main = paste("plot symbols : points (... pch = *, cex =",
cex,")"))
{
nex <- length(extras)
np <- 26 + nex
ipch <- 0:(np-1)
k <- floor(sqrt(np))
dd <- c(-1,1)/2
rx <- dd + range(ix <- ipch %/% k)
ry <- dd + range(iy <- 3 + (k-1)- ipch %% k)
pch <- as.list(ipch) # list with integers & strings
if(nex > 0) pch[26+ 1:nex] <- as.list(extras)
plot(rx, ry, type="n", axes = FALSE, xlab = "", ylab = "",
main = main)
abline(v = ix, h = iy, col = "lightgray", lty = "dotted")
for(i in 1:np) {
pc <- pch[[i]]
## 'col' symbols with a 'bg'-colored interior (where available) :
points(ix[i], iy[i], pch = pc, col = col, bg = bg, cex = cex)
if(cextext > 0)
text(ix[i] - 0.3, iy[i], pc, col = coltext, cex = cextext)
}
}
pchShow()
- (670)How to show all the possible graphical colors?
?rainbow has some examples, like:
require(graphics)
# A Color Wheel
pie(rep(1,12), col=rainbow(12))
##------ Some palettes ------------
demo.pal <-
function(n, border = if (n<32) "light gray" else NA,
main = paste("color palettes; n=",n),
ch.col = c("rainbow(n, start=.7, end=.1)", "heat.colors(n)",
"terrain.colors(n)", "topo.colors(n)",
"cm.colors(n)"))
{
nt <- length(ch.col)
i <- 1:n; j <- n / nt; d <- j/6; dy <- 2*d
plot(i,i+d, type="n", yaxt="n", ylab="", main=main)
for (k in 1:nt) {
rect(i-.5, (k-1)*j+ dy, i+.4, k*j,
col = eval(parse(text=ch.col[k])), border = border)
text(2*j, k * j +dy/4, ch.col[k])
}
}
n <- if(.Device == "postscript") 64 else 16
# Since for screen, larger n may give color allocation problem
demo.pal(n)
- (671)How to get points with transparency/aplha channel color?
R> palet <- cm.colors(10, apha=.3) ;
or
R> palet <- cm.colors(10) ;
R> colos <- adjustcolor(palet, alpha.f = 0.3) ;
- (672)How to get the matlab color map?
R> install.packages("matlab") ;
R> library("matlab") ;
R> pie(x, col = jet.colors(length(x))) ;
- (673)How to install packages in RWeka?
library(RWeka)
make_Weka_clusterer("weka.clusterers.EM") ;
list_Weka_interfaces() ;
#Available actions and respective additional arguments are as follows:
#"refresh-cache" Refresh the cached copy of the package meta data from the central package repository.
#"list-packages" print information (version numbers and short descriptions) about packages as specified by an additional keyword which must be one of "all" (all packages the system knows about), "installed" (all packages installed locally$
#"package-info" print information (metadata) about a package. Requires two additional character string arguments: a keyword and the package name. The keyword must be one of "repository" (print info from the repository) or "installed" (pri$
#"install-package" install a package as specified by an additional character string giving its name. (In principle, one could also provide a file path or URL to a zip file.)
#"remove-package" remove a given (installed) package.
#"load-package" load a given package by adding its jars to the Java classpath.
WPM("refresh-cache") ;
WPM("list-packages", "installed") ;
WPM("list-packages", "available") ;
WPM("package-info", "repository", "XMeans") ;
WPM("install-package", "LVQ") ;
WPM("load-package", "LVQ") ;
list_Weka_interfaces() ;
make_Weka_clusterer("weka.clusterers.LVQ") ;
list_Weka_interfaces() ;
- (674)How to concatenate several dataframe saved in a list?
R> library(plyr)
R> df2 <- data.frame(A=c(10,20,30),B=c(20,30,40))
R> li <- list(TOTO=df,TITI=df2)
R> ldply(li,rbind)
- (675)Introspection functions
eval
expression
parse/deparse
get
quote/enquote
call/do.call/.Call
substitute
- (676)How to set the number of cores/process R can use?
mc.cores: a integer giving the maximum allowed number of
_additional_ R processes allowed to be run in parallel to the
current R process. Defaults to the setting of the
environment variable \342\200\230MC_CORES\342\200\231 if set. Most applications
which use this assume a limit of \342\200\2302\342\200\231 if it is unset.
To be set using options(), for instance in ~/.Rprofile
- (677)How to set # of columns?
ls <- Sys.getenv("COLUMNS")
if(nzchar(cols)) options(width = as.integer(cols))
From: ?Startup
- (678)How to get colors in prompt without messing up readline?
From: https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14800
This appears to be a matter of not understanding the cause of the problem.
Can't say that I do entirely either, but a bit of further googling led to this,
from a Ruby forum:
# readline.h
/* Definitions available for use by readline clients. */
#define RL_PROMPT_START_IGNORE '\001'
#define RL_PROMPT_END_IGNORE '\002'
Bash handles this issue by mapping `\[' and `\]' to
RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE inside of `PS*' prompt variables.
So trying to get "\[" into the prompt string is unlikely to work in R, and it
wasn't done right anyway -- read up on R's mechanisms for escaping special
characters in strings; see help("Quotes").
This appears to work for me (had I actually wanted a bright green "R>" in a
"Red Sands" terminal window!):
options(prompt="\001\033[01;32m\002R> \001\033[00m\002")
- (679)How to get nrow/ncol whathever the type of collection (vector/data.frame/etc.) used?
use: NCOL/NROW
see: ?NCOL
- (680)How to draw a smoothing of a chaotic curve (polynomial regression)?
see ?lowess / ?loess
- (681)How to force garbage collection?
see ?gc:
gc(verbose = getOption("verbose"), reset=FALSE)
gcinfo(verbose)
- (682)How to evaluate only partially a part of code?
Use bquote()
Example: do a function B that returns a function A with some
parameters fixed from the parameters of B.
R> B <- function(param=1)
{
return(A=bquote(function(x) { return(.(param)) ; })) ;
}
R> B(12)
function(x) {
return(12)
}
R> B(15)
function(x) {
return(15)
}
- (683)A shortened & functional version of if/then/else?
R > ifelse(cond,ifcond,elsecond) ;
- (684)How to serialize a Java (e.g. Weka) object from R?
library(rJava) ;
write(.jserialize(model$classifier), "/tmp/model_classifier.out") ;
- (685)Useful funcitons for timeseries
R> ?window
R> ?lag
R> ?diff
- (686)How to draw a function?
see ?curve
- (687)How to compare if 2 objects have identical values?
see ?identical or ?all.equal
or package "compare" [manages precision errors???]
> identical(0.3 - 0.2, 0.1)
[1] FALSE
> all.equal(0.3 - 0.2, 0.1)
[1] TRUE
- (688)How to create/call R code directly in Java?
RCaller caller = new RCaller();
caller.setRscriptExecutable("/usr/bin/Rscript");
RCode code = new RCode();
double[] numbers = new double[] {1, 4, 3, 5, 6, 10};
code.addDoubleArray("x", numbers);
File file = code.startPlot();
System.out.println("Plot will be saved to : " + file);
code.addRCode("plot.ts(x)");
code.endPlot();
caller.setRCode(code);
caller.runOnly();
code.showPlot(file);
- (689)How to compute an AND or an OR on a vector of Booleans?
any <-> or
all <-> and
- (690)How to rotate a plot [Does not work with a base::plot() but grid::xyplot(), etc.]?
library(lattice)
library(grid)
grid.newpage()
pushViewport(viewport(angle = 90, name = "VP")) ;
upViewport();
x <- 1:10
print(xyplot(x ~ x, groups = gl(2, 5), auto.key = TRUE), draw.in = "VP") ;
---
grid.newpage()
pushViewport(viewport(angle = 90))
x <- 1:10
print(xyplot(x ~ x, groups = gl(2, 5), auto.key = TRUE), newpage = FALSE) ;
upViewport()
From: http://tolstoy.newcastle.edu.au/R/e2/help/06/09/0447.html
---
myhist <- hist(rnorm(50))
# Make two square regions side by side
pushViewport(viewport(layout=grid.layout(1, 2, respect=TRUE)))
# Go to the left region
pushViewport(viewport(layout.pos.col=1))
# Draw the histogram in normal orientation
print(myhist, newpage=FALSE)
popViewport()
# Go to the right region then rotate 90 degrees
pushViewport(viewport(layout.pos.col=2), viewport(angle=90))
# Draw the histogram (rotated 90 degrees)
print(myhist, newpage=FALSE)
popViewport(3)
From: https://stat.ethz.ch/pipermail/r-help/2003-October/040356.html
- (12)How to control the mouse with the numpad (thanlks to gwen)
On peut très facilement contrôler le curseur avec les chiffres du pavé numérique.
Pour cela il suffit de presser shift+verr-num.
Le curseur se dirige avec les chiffres.
On choisit le bouton avec /,*,-.
5 pour un simple clic,
5 5 pour un double
0, mouvement, 5 pour un drag&drop.
http://linuxfr.org/tips/78.html
- (137)Change the level of the backlight
Get the possibilities and IDs of the screen
$ xrandr --prop
$ xrandr --output LVDS --set BACKLIGHT_CONTROL {combination, native, legacy,kernel}
$ xrandr --output LVDS --set BACKLIGHT 1001
$ xbacklight -get
$ xgamma
- (138)Configure compose key to manage all types of accents
Simply add "keycode <unused key: ex win-popup=115> = Multi_key" in ~/.Xmodmap
- (136)Set up the colors
use xgamma -rgamma [.1 1.0] -ggamma [.1 1.0] -bgamma [.1 1.0]
- (161)Sometimes the window manager does not start
The full path of the window manager must appear in the .xinitrc
- (178)How to allow Xnest to open the display in order to receive windows
Xnest -ac :1
-ac to remove access control
- (182)Reload the Xresources file
xrdb -merge ~/. Xresources
- (277)Dynamically change resolution / frate / ...
1. Compute MODE
cvt 1280 1280 60
=># 1280x1280 59.96 Hz (CVT) hsync: 79.57 kHz; pclk: 137.50 MHz
=>Modeline "1280x1280_60.00" 137.50 1280 1368 1504 1728 1280 1283 1293 1327 -hsync +vsync
2. Create MODE and add MODE to output (copy end of 2nd line: see [])
xrandr --output LVDS --newmode ["1280x1280_60.00" 137.50 1280 1368 1504 1728 1280 1283 1293 1327 -hsync +vsync]
xrandr --addmode LVDS "1280x1280_60.00"
3. Use MODE
xrandr --output LVDS --mode "1280x1280_60.00"
- (288)In awesome, if a program, for instance ThB or Evolution, does not tile (and shows a butterfly)
Then it may be a problem of floating or maximization => bind a key to float/maximize in awesome config file
- (291)When audacious appears on all desks of the WM
It might be a problem of the WM (sticky windows, floating, maximized) or a problem in audacious
=> try to rename/remove .config/audacious
- (353)Change the keys for moving windows insde the same screen in awesome
awful.button({ modkey, "Control" }, 1, awful.mouse.client.move)
- (357)How to start .xsession in awesome (a.k.a. how to define startup applications without any Desktop Manager while using a Session Manager)
Add the two following lines:
-- Load script that launches startup applications
os.execute("source ~/.xsession");
to your ~/.config/awesome/rc.lua file
- (361)How to circumvent a bug in GDM (2.32) where it cannot stop from beeping at boot even if sound if shutdown in gdmsetup & gnome-volume-control?
From: https://bugzilla.redhat.com/show_bug.cgi?id=503360
1. Use gconf-editor to disable
apps/gdm/simple-greeter/setting-manager-plugins/sound
2. # rm -rf /var/lib/gdm/.gconf/
3. # cp -r /root/.gconf /var/lib/gdm/.
4. # chown -R gdm:gdm /var/lib/gdm/.gconf
5. # gnome-volume-control
6. Set 'Sound Theme' to 'No sounds'
7. Close gnome-volume-control
8. Re-logon
9. Enjoy reclaimed silence :)
--------------------------------------------------
try to blacklist pcspkr module, just add to your /etc/modprobe.d/blacklist the
following line:
blacklist pcspkr
--------------------------------------------------
/usr/bin/gconftool-2 --direct \
--config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
-t bool -s /desktop/gnome/sound/event_sounds false
--------------------------------------------------
gconftool-2 --type=bool --set /desktop/gnome/sound/event_sounds false
gconftool-2 --type=bool --set /apps/gnome_settings_daemon/plugins/sound/active false
gconftool-2 --type=bool --set /apps/gdm/simple-greeter/settings-manager-plugins/sound/active false
----
Add to .gtkrc-2.0
gtk-enable-event-sounds=0
gtk-enable-input-feedback-sounds=0
gtk-error-bell=0
- (365)My Awesome (v3.4.9) config file (for 2 screens display)
(
CTL-ALT-arrows switches current screen's vdesktop
CTL-ALT-Q quits
CTL-ALT-a maximizes
CTL-ALT-i minimizes
CTL-ALT-f toogles floating
CTL-ALT-mousemove moves window
CTL-ALT-k kills
CTL-ALT-Tab activate next window
CTL-ALT-KP_8/2 resises active window
CTL-ALT-r restarts awesome (reload config file)
CTL-ALT(-SHIFT)space selects next/previous tiling algo/style
CTL-ALT-h/l toogles secondary tiling algo/style
CTL-ALT-mouse1 moves active window to selected workspace
CTL-ALT-mouse3 resises active window
)
-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- Load Debian menu entries
require("debian.menu")
-- GM: Load script that launches startup applications
os.execute("source ~/.xsession");
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init("/home/gmuller/.config/awesome/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "uxterm"
editor = os.getenv("EDITOR") or "editor"
editor_cmd = terminal .. " -e " .. editor
xlockcmd = " xscreensaver-command -lock"
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod1"
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.spiral,
awful.layout.suit.spiral.dwindle,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier,
awful.layout.suit.floating
}
-- }}}
-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = awful.tag({ "Chat-" .. s, "W1-" .. s, "W2-" .. s, "W3-" .. s, "Mail-" .. s, "Web-" .. s, "Mumule-" .. s }, s, layouts[1])
end
-- }}}
-- {{{ Menu
-- Create a laucher widget and a main menu
myawesomemenu = {
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
{ "restart", awesome.restart },
{ "quit", awesome.quit }
}
mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "Debian", debian.menu.Debian_menu.Debian },
{ "Terminal", terminal },
{ "XChat", "xchat" },
{ "Midori", "midori" },
{ "Firefox", "firefox" },
{ "Thunderbird", "thunderbird" },
{ "Evolution", "evolution" },
{ "Audacious", "audacious2" },
{ "Nautilus", "nautilus" },
{ "Xlock", xlockcmd }
}
})
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu })
-- }}}
-- {{{ Wibox
-- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" })
xchatbox = widget({ type="imagebox", name="icon", align=align })
xchatbox.image = image("/usr/local/lib/xemacs/xemacs-packages/etc/xwem/mini-xchat.xpm")
xchatbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("xchat") end)))
midoribox = widget({ type="imagebox", name="icon", align=align })
midoribox.image = image("/usr/share/icons/gnome-colors-common/24x24/apps/midori.png")
midoribox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("midori") end)))
firefoxbox = widget({ type="imagebox", name="icon", align=align })
firefoxbox.image = image("/usr/lib/xulrunner-1.9.2.17/chrome/icons/default/default32.png")
firefoxbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("firefox") end)))
thunderbirdbox = widget({ type="imagebox", name="icon", align=align })
thunderbirdbox.image = image("/usr/share/icons/Mint-X/apps/24/mozilla-thunderbird.png")
thunderbirdbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("thunderbird") end)))
evolutionbox = widget({ type="imagebox", name="icon", align=align })
evolutionbox.image = image("/usr/share/icons/hicolor/24x24/apps/evolution.png")
evolutionbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("evolution") end)))
audaciousbox = widget({ type="imagebox", name="icon", align=align })
audaciousbox.image = image("/usr/share/icons/Mint-X/apps/24/audacious.png")
audaciousbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("audacious2") end)))
nautilusbox = widget({ type="imagebox", name="icon", align=align })
nautilusbox.image = image("/usr/share/icons/Mint-X/apps/24/nautilus.png")
nautilusbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("nautilus") end)))
xlockbox = widget({ type="imagebox", name="icon", align=align })
xlockbox.image = image("/usr/local/lib/xemacs/xemacs-packages/etc/gnus/lock.xpm")
xlockbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn(xlockcmd) end)))
-- Create a systray
mysystray = widget({ type = "systray" })
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey, "Control" }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
client.focus = c
c:raise()
end),
awful.button({ }, 3, function ()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 })
end
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end))
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(function(c)
return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons)
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s })
-- Add widgets to the wibox - order matters
mywibox[s].widgets = {
{
mylauncher,
mytaglist[s],
mypromptbox[s],
layout = awful.widget.layout.horizontal.leftright
},
mylayoutbox[s],
mytextclock,
xlockbox,
nautilusbox,
audaciousbox,
evolutionbox,
thunderbirdbox,
firefoxbox,
midoribox,
xchatbox,
s == 1 and mysystray or nil,
mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft
}
end
-- }}}
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, "Control" }, "Left", awful.tag.viewprev ),
awful.key({ modkey, "Control" }, "Right", awful.tag.viewnext ),
awful.key({ modkey, "Control" }, "Escape", awful.tag.history.restore),
awful.key({ modkey, "Control" }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
-- awful.key({ modkey, }, "k",
-- function ()
-- awful.client.focus.byidx(-1)
-- if client.focus then client.focus:raise() end
-- end),
-- awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end),
-- Layout manipulation
-- awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
-- awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
-- awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
-- awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
-- awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, "Control" }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Standard program
awful.key({ modkey, "Control" }, "Return", function () awful.util.spawn(terminal) end),
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Control" }, "q", awesome.quit),
awful.key({ modkey, "Control" }, "KP_8", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, "Control" }, "KP_2", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, "Control" }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Control", "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
-- Prompt
awful.key({ modkey, "Control" }, "x", function () mypromptbox[mouse.screen]:run() end)
--,
-- awful.key({ modkey }, "x",
-- function ()
-- awful.prompt.run({ prompt = "Run Lua code: " },
-- mypromptbox[mouse.screen].widget,
-- awful.util.eval, nil,
-- awful.util.getdir("cache") .. "/history_eval")
-- end)
)
clientkeys = awful.util.table.join(
-- awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Control" }, "k", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "f", awful.client.floating.toggle ),
awful.key({ modkey, "Shift" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, "Control" }, "i", function (c) c.minimized = not c.minimized end),
awful.key({ modkey, "Control" }, "a",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
end)
)
-- Compute the maximum number of digit we need, limited to 9
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber));
end
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, "#" .. i + 9,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end),
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i])
end
end),
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i])
end
end),
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i])
end
end))
end
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey, "Control" }, 1, awful.mouse.client.move),
awful.button({ modkey, "Control" }, 3, awful.mouse.client.resize))
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ Rules
-- {{{ Rules
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
buttons = clientbuttons } },
-- GM
{ rule = { class = "Audacious" },
properties = { tag = tags[1][4] } }, -- W3-1 --, switchtotag = true
{ rule = { class = "Navigateur" }, -- "Navigator"
properties = { tag = tags[2][6], maximized_horizontal = true, maximized_vertical = true } }, -- Web-2 --switchtotag = true,
{ rule = { class = "Firefox" }, -- "Navigator"
properties = { tag = tags[2][6], maximized_horizontal = true, maximized_vertical = true } }, -- Web-2 --switchtotag = true,
{ rule = { class = "gimp" },
properties = { floating = true } },
{ rule = { class = "LibreOffice" },
properties = { maximized_horizontal = true, maximized_vertical = true } },
{ rule = { class = "Midori" },
properties = { tag = tags[2][6], maximized_horizontal = true, maximized_vertical = true } }, -- Web-2 --- switchtotag = true,
{ rule = { class = "MPlayer" },
properties = { floating = true } },
{ rule = { class = "pinentry" },
properties = { floating = true } },
{ rule = { class = "Mail" }, -- "Mail"
properties = { tag = tags[2][5] } }, -- Mail-2 --, switchtotag = true
{ rule = { class = "Thunderbird" }, -- "Mail"
properties = { tag = tags[2][5] } }, -- Mail-2 --, switchtotag = true
{ rule = { class = "Wine" },
properties = { maximized_horizontal = true, maximized_vertical = true } },
{ rule = { class = "Xchat" },
properties = { tag = tags[1][1] } }, -- Chat-1 --, switchtotag = true
{ rule = { class = "Xpdf" },
properties = { maximized_horizontal = true, maximized_vertical = true } },
-- Set Firefox to always map on tags number 2 of screen 1.
-- { rule = { class = "Firefox" },
-- properties = { tag = tags[1][2] } },
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.add_signal("manage", function (c, startup)
-- Add a titlebar
-- awful.titlebar.add(c, { modkey = modkey })
-- Enable sloppy focus
c:add_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end)
if not startup then
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c)
-- Put windows in a smart way, only if they does not set an initial position.
if not c.size_hints.user_position and not c.size_hints.program_position then
awful.placement.no_overlap(c)
awful.placement.no_offscreen(c)
end
end
end)
client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
- (370)How to run a .xsession at awesome startup?
The one that works (combinaison of the 2 that follow)
os.execute("source ~/.xsession");
----------------------------------------------------------------------
>> If you start awesome from the command line, you can run programs
>> by putting them in your ~/.xinitrc file:
>>
>> xscreensaver -nosplash &
>>
>> (the "&" makes execution of the xinitrc file continue)
>>
>> If you run awesome from a graphical login (xdm/gdm/kdm),
>> you can use ~/.xsession in a similar manner.
----------------------------------------------------------------------
From: https://wiki.archlinux.org/index.php/Awesome3
Autorun programs
See also the Autostart page on the Awesome wiki105.
awesome doesn't run programs set to autostart by the Freedesktop specification like GNOME or KDE. However, awesome does provide a few functions for starting programs (in addition to the Lua standard library function os.execute). To run the same programs on startup as GNOME or KDE, you can install dex106 from the AUR107 and then run that in your rc.lua:
os.execute"dex -a"
If you just want to set up a list of apps for awesome to launch at startup, you can create a table of all the commands you want to spawn and loop through it:
do
local cmds =
{
"swiftfox",
"mutt",
"consonance",
"linux-fetion",
"weechat-curses",
--and so on...
}
for _,i in pairs(cmds) do
awful.util.spawn(i)
end
end
(You could also run calls to os.execute with commands ending in '&', but it's probably a better idea to stick to the proper spawn function.)
To run a program only if it is not currently running, you can spawn it with a shell command that runs the program only if pgrep doesn't find a running process with the same name:
function run_once(prg)
awful.util.spawn_with_shell("pgrep -u $USER -x " .. prg .. " || (" .. prg .. ")")
end
So, for example, to run parcellite only if there is not a parcellite process already running:
run_once("parcellite")
- (377)Cannot move old logfile ("/var/log/Xorg.0.log" to "/var/log/Xorg.0.log.old"
This happens when xorg 7.2 gets installed from a package, and there is already
an earlier xorg 6.x installed.
- (385)How to get the name of the running application from its window? (useful to define the "rules" section of rc.lua in awesome)
xwininfo or
xprop (WM_CLASS)
How to define the "rules" section of of rc.lua in awesome?
Use a small-cased version of the name of the application (got it using xprop)
e.g., it had to be "g", even though: WM_CLASS(STRING) = "gimp", "Gimp"
From: http://www.docunext.com/blog/2009/11/awesomewm-titlebar-34-1-update.html
- (394)How to set the lightning of the screen?
man xrandr
--brightness brightness
Multiply the gamma values on the crtc currently attached to the
output to specified floating value. Useful for overly bright or
overly dim outputs. However, this is a software only
modification, if your hardware has support to actually change
the brightness, you will probably prefer to use xbacklight.
=> use xbacklight !!!
- (414)How to change Gtk's theme?
ln -s /usr/share/themes/Clearlooks/gtk-2.0/gtkrc .gtkrc-2.0
- (497)How to set the keyboard options correctly?
Add this line in your .xinitrc (if using startx) or .xsession (if using a display manager):
setxkbmap -layout us -variant dvorak -option ctrl:nocaps -option compose:menu
- (476)How to solve "No protocol specified" error in Xorg
I had the exact same problem, not able to start from user, able to start in
root, same "No protocol specified .. No protocol specified ..", etc.
Solved by deleting the .Xauthority in the users home directory.
- (477)How to build a simple keyloader (in userland!)?
xinput list
xinput test <id kdb>
- (480)Set keyboard to dvorak-fr-mouette
// concaténer ce fichier dans /usr/share/X11/xkb/symbols/fr
// activer avec : setxkbmap -variant dvorak-fr-mouette
// désactiver avec : setxkbmap -variant basic
// Keymap Dvorak pour le Français
// par Josselin Mouette <josselin.mouette@ens-lyon.org>.
partial alphanumeric_keys
xkb_symbols "dvorak-fr-mouette" {
name[Group1]= "France - (Legacy) Dvorak";
key <TLDE> { [ oe, OE, ae, AE ] };
key <AE01> { [ slash, 1, ampersand, onesuperior ] };
key <AE02> { [ plus, 2, asciitilde, twosuperior ] };
key <AE03> { [ minus, 3, numbersign, threesuperior ] };
key <AE04> { [ asterisk, 4, less, guillemotleft ] };
key <AE05> { [ equal, 5, greater, guillemotright ] };
key <AE06> { [ backslash, 6, at, notsign ] };
key <AE07> { [ parenleft, 7, dead_circumflex, multiply ] };
key <AE08> { [ grave, 8, dead_grave, division ] };
key <AE09> { [ parenright, 9, asciicircum, plusminus ] };
key <AE10> { [ quotedbl, 0, dead_diaeresis, dead_diaeresis ] };
key <AE11> { [bracketleft, braceleft, bar, degree ] };
key <AE12> { [bracketright, braceright, percent, percent ] };
key <AD01> { [ colon, question, question, questiondown ] };
key <AD02> { [ agrave, Agrave, aring, Aring ] };
key <AD03> { [ eacute, Eacute, EuroSign, cent ] };
key <AD04> { [ g, G, oslash, Ooblique ] };
key <AD05> { [ period, exclam, periodcentered, exclamdown ] };
key <AD06> { [ h, H, eth, ETH ] };
key <AD07> { [ v, V ] };
key <AD08> { [ c, C, copyright, registered ] };
key <AD09> { [ m, M, mu, mu ] };
key <AD10> { [ k, K, dollar, dollar ] };
key <AD11> { [ egrave, Egrave, sterling, sterling ] };
key <AD12> { [ z, Z, yen, yen ] };
key <AC01> { [ o, O, ocircumflex, Ocircumflex ] };
key <AC02> { [ a, A, acircumflex, Acircumflex ] };
key <AC03> { [ u, U, ucircumflex, Ucircumflex ] };
key <AC04> { [ e, E, ecircumflex, Ecircumflex ] };
key <AC05> { [ b, B, ssharp, ssharp ] };
key <AC06> { [ f, F ] };
key <AC07> { [ s, S ] };
key <AC08> { [ t, T, thorn, THORN ] };
key <AC09> { [ n, N, ntilde, Ntilde ] };
key <AC10> { [ d, D, section, section ] };
key <AC11> { [ w, W, paragraph, paragraph ] };
key <BKSL> { [ ugrave, Ugrave, masculine, ordfeminine ] };
key <AB01> { [ apostrophe, underscore, dead_acute, macron ] };
key <AB02> { [ q, Q, guillemotleft, guillemotleft ] };
key <AB03> { [ comma, semicolon, guillemotright, guillemotright ] };
key <AB04> { [ i, I, icircumflex, Icircumflex ] };
key <AB05> { [ y, Y, ydiaeresis, Ydiaeresis ] };
key <AB06> { [ x, X, ediaeresis, Ediaeresis ] };
key <AB07> { [ r, R, udiaeresis, Udiaeresis ] };
key <AB08> { [ l, L, adiaeresis, Adiaeresis ] };
key <AB09> { [ p, P, odiaeresis, Odiaeresis ] };
key <AB10> { [ j, J, idiaeresis, Idiaeresis ] };
key <SPCE> { [ space, space, nobreakspace, nobreakspace ] };
key <LSGT> { [ ccedilla, Ccedilla ] };
include "level3(ralt_switch)"
};
// setxkbmap -layout fr -variant dvorak-fr-mouette
// Use KTouch to train :)
- (481)Awesome's configuration file (rc.lua) from work (AiRPX)
-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- Load Debian menu entries
require("debian.menu")
-- GM: Load script that launches startup applications
os.execute("source ~/.xsession");
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init("/home/gmuller/.config/awesome/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "uxterm"
editor = os.getenv("EDITOR") or "editor"
editor_cmd = terminal .. " -e " .. editor
xlockcmd = " xscreensaver-command -lock"
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod1"
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.spiral,
awful.layout.suit.spiral.dwindle,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier,
awful.layout.suit.floating
}
-- }}}
-- {{{ Tags
-- Define a tag table which hold all screen tags.
tags = {}
for s = 1, screen.count() do
-- Each screen has its own tag table.
tags[s] = awful.tag({ "Chat-" .. s, "W1-" .. s, "W2-" .. s, "W3-" .. s, "Mail-" .. s, "Web-" .. s, "Mumule-" .. s }, s, layouts[1])
end
-- }}}
-- {{{ Menu
-- Create a laucher widget and a main menu
myawesomemenu = {
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
{ "restart", awesome.restart },
{ "quit", awesome.quit }
}
mymainmenu = awful.menu.new({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "Debian", debian.menu.Debian_menu.Debian },
{ "Terminal", terminal },
{ "XChat", "xchat" },
{ "Midori", "midori" },
{ "Firefox", "firefox" },
{ "Thunderbird", "thunderbird" },
{ "Evolution", "evolution" },
{ "Audacious", "audacious2" },
{ "Nautilus", "nautilus" },
{ "Xlock", xlockcmd }
}
})
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu })
-- }}}
-- {{{ Wibox
-- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" })
xchatbox = widget({ type="imagebox", name="icon", align=align })
xchatbox.image = image("/usr/local/lib/xemacs/xemacs-packages/etc/xwem/mini-xchat.xpm")
xchatbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("xchat") end)))
midoribox = widget({ type="imagebox", name="icon", align=align })
midoribox.image = image("/usr/share/icons/gnome-colors-common/24x24/apps/midori.png")
midoribox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("midori") end)))
firefoxbox = widget({ type="imagebox", name="icon", align=align })
firefoxbox.image = image("/usr/lib/xulrunner-1.9.2.17/chrome/icons/default/default32.png")
firefoxbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("firefox") end)))
thunderbirdbox = widget({ type="imagebox", name="icon", align=align })
thunderbirdbox.image = image("/usr/share/icons/Mint-X/apps/24/mozilla-thunderbird.png")
thunderbirdbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("thunderbird") end)))
evolutionbox = widget({ type="imagebox", name="icon", align=align })
evolutionbox.image = image("/usr/share/icons/hicolor/24x24/apps/evolution.png")
evolutionbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("evolution") end)))
audaciousbox = widget({ type="imagebox", name="icon", align=align })
audaciousbox.image = image("/usr/share/icons/Mint-X/apps/24/audacious.png")
audaciousbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("audacious2") end)))
nautilusbox = widget({ type="imagebox", name="icon", align=align })
nautilusbox.image = image("/usr/share/icons/Mint-X/apps/24/nautilus.png")
nautilusbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn("nautilus") end)))
xlockbox = widget({ type="imagebox", name="icon", align=align })
xlockbox.image = image("/usr/local/lib/xemacs/xemacs-packages/etc/gnus/lock.xpm")
xlockbox:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn(xlockcmd) end)))
-- Create a systray
mysystray = widget({ type = "systray" })
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey, "Control" }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
client.focus = c
c:raise()
end),
awful.button({ }, 3, function ()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 })
end
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end))
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(function(c)
return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons)
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s })
-- Add widgets to the wibox - order matters
mywibox[s].widgets = {
{
mylauncher,
mytaglist[s],
mypromptbox[s],
layout = awful.widget.layout.horizontal.leftright
},
mylayoutbox[s],
mytextclock,
xlockbox,
nautilusbox,
audaciousbox,
evolutionbox,
thunderbirdbox,
firefoxbox,
midoribox,
xchatbox,
s == 1 and mysystray or nil,
mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft
}
end
-- }}}
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, "Control" }, "Left", awful.tag.viewprev ),
awful.key({ modkey, "Control" }, "Right", awful.tag.viewnext ),
awful.key({ modkey, "Control" }, "Escape", awful.tag.history.restore),
awful.key({ modkey, "Control" }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
-- awful.key({ modkey, }, "k",
-- function ()
-- awful.client.focus.byidx(-1)
-- if client.focus then client.focus:raise() end
-- end),
-- awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end),
-- Layout manipulation
-- awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
-- awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
-- awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
-- awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
-- awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, "Control" }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Standard program
awful.key({ modkey, "Control" }, "Return", function () awful.util.spawn(terminal) end),
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Control" }, "q", awesome.quit),
awful.key({ modkey, "Control" }, "KP_8", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, "Control" }, "KP_2", function () awful.tag.incmwfact(-0.05) end),
-- awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
-- awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, "Control" }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Control", "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
-- Prompt
awful.key({ modkey, "Control" }, "x", function () mypromptbox[mouse.screen]:run() end)
--,
-- awful.key({ modkey }, "x",
-- function ()
-- awful.prompt.run({ prompt = "Run Lua code: " },
-- mypromptbox[mouse.screen].widget,
-- awful.util.eval, nil,
-- awful.util.getdir("cache") .. "/history_eval")
-- end)
)
clientkeys = awful.util.table.join(
-- awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Control" }, "k", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "f", awful.client.floating.toggle ),
-- awful.key({ modkey, "Shift" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
-- awful.key({ modkey, }, "o", awful.client.movetoscreen ),
-- awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
-- awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, "Control" }, "i", function (c) c.minimized = not c.minimized end),
awful.key({ modkey, "Control" }, "a",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
end)
)
-- Compute the maximum number of digit we need, limited to 9
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber));
end
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, "#" .. i + 9,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end),
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local screen = mouse.screen
if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i])
end
end),
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i])
end
end),
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i])
end
end))
end
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey, "Control" }, 1, awful.mouse.client.move),
awful.button({ modkey, "Control" }, 3, awful.mouse.client.resize))
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ Rules
-- {{{ Rules
secondScreen = screen.count();
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
buttons = clientbuttons } },
-- GM
{ rule = { class = "Audacious" },
properties = { tag = tags[1][4] } }, -- W3-1 --, switchtotag = true
{ rule = { class = "Navigateur" }, -- "Navigator"
properties = { tag = tags[secondScreen][6], maximized_horizontal = true, maximized_vertical = true } }, -- Web-2 --switchtotag = true,
{ rule = { class = "Firefox" }, -- "Navigator"
properties = { tag = tags[secondScreen][6], maximized_horizontal = true, maximized_vertical = true } }, -- Web-2 --switchtotag = true,
{ rule = { class = "gimp" },
properties = { floating = true } },
{ rule = { class = "Geeqie" },
properties = { maximized_horizontal = true, maximized_vertical = true } },
{ rule = { class = "LibreOffice" },
properties = { maximized_horizontal = true, maximized_vertical = true } },
{ rule = { class = "Midori" },
properties = { maximized_horizontal = true, maximized_vertical = true } }, -- Web-2 --- switchtotag = true,
{ rule = { class = "MPlayer" },
properties = { floating = true } },
{ rule = { class = "pinentry" },
properties = { floating = true } },
{ rule = { class = "Mail" }, -- "Mail"
properties = { tag = tags[secondScreen][5] } }, -- Mail-2 --, switchtotag = true
{ rule = { class = "Thunderbird" }, -- "Mail"
properties = { tag = tags[secondScreen][5] } }, -- Mail-2 --, switchtotag = true
{ rule = { class = "Wine" },
properties = { maximized_horizontal = true, maximized_vertical = true } },
{ rule = { class = "Xchat" },
properties = { tag = tags[1][1] } }, -- Chat-1 --, switchtotag = true
{ rule = { class = "Xpdf" },
properties = { maximized_horizontal = true, maximized_vertical = true } },
-- Set Firefox to always map on tags number 2 of screen 1.
-- { rule = { class = "Firefox" },
-- properties = { tag = tags[1][2] } },
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.add_signal("manage", function (c, startup)
-- Add a titlebar
-- awful.titlebar.add(c, { modkey = modkey })
-- Enable sloppy focus
c:add_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end)
if not startup then
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c)
-- Put windows in a smart way, only if they does not set an initial position.
if not c.size_hints.user_position and not c.size_hints.program_position then
awful.placement.no_overlap(c)
awful.placement.no_offscreen(c)
end
end
end)
client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
- (550)Where are Awesome's error logged?
In .xsession-errors
- (568)How to persistanly export your X-applications/DISPLAY [a.k.a. a "screen/tmux" for X]?
Use Xpra: https://code.google.com/p/partiwm/wiki/xpra
# On server/distant machine
xpra start :7 # Start an xpra server using display number :7.
DISPLAY=:7 firefox # Start firefox running inside the xpra server. No window will appear.
# or:
# export DISPLAY=:7 ; firefox
# On local machine
xpra attach ssh:<server ip>:7 # Use ssh to attach to the xpra server that is running on machine frodo and using display :7. Any apps running on that server will appear on your local screen.
# You can also use
# xpra list Show a list of xpra servers you have running on the current host.
- (578)How to change the font size quickly in XTerm?
Alt-Maj +/-
- (611)How to manage gnome keyring?
$ seahorse
- (612)Where are Nautilus bookmarks stored?
in ~/.gtk-bookmarks
- (613)How to make Nautilus remember passwords?
In fact, the keyring actually stores the credentials, but the domain is missing in the bokkmarks, so nautilus does not recognize the share being obtained.
The solution is to add the domain in the bookmarks file:
vi ~/.gtk-bookmarks
The patern is:
smb://DOMAIN;USER@MACHINE/SHAREDDIR
From:
https://bugzilla.gnome.org/show_bug.cgi?id=618091
http://www.clearfoundation.com/docs/howtos/add_linux_workstation_to_the_samba_domain
http://darklaunch.com/2010/10/31/where-are-nautilus-bookmarks-stored-nautilus-bookmark-location
- (615)How to disable sound in GDM?
1. Use gconf-editor to disable
apps/gdm/simple-greeter/setting-manager-plugins/sound
2. # rm -rf /var/lib/gdm/.gconf/
3. # cp -r /root/.gconf /var/lib/gdm/.
4. # chown -R gdm:gdm /var/lib/gdm/.gconf
5. # gnome-volume-control
6. Set 'Sound Theme' to 'No sounds'
7. Close gnome-volume-control
8. Re-logon
9. Enjoy reclaimed silence :)
From: https://bugzilla.redhat.com/show_bug.cgi?id=503360
- (700)Script to switch off screens
sleep 1; xset dpms force off
- (701)Script to automatically set screen/overhead projector best resolution
xrandr --output LVDS1 --auto
xrandr --output VGA1 --auto
- (703)How to reduce the Xorg screen?
xrandr --output VGA1 --scale 0.9x0.9
- (707)How to swap CTL and CAPSLOCK with Xmodmap?[wrong way to do it!]
!
! Swap Caps_Lock and Control_L
!
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
And to recover:
echo -e "remove Lock = Caps_Lock \n remove Control = Control_L \n keycode 37 = Caps_Lock \n keycode 66 = Control_L \n add Lock = Caps_Lock \nadd Control = Control_L" | xmodmap -
The right way to do it:
setxkbmap -option ctrl:swapcaps
- (708)How to restart XFCE?
xfwm4 --replace &
- (710)Script to disable annoying sounds in GDM
# Mute (use 'M' key) 'Beep' output in alsamixer
amixer sset 'Beep' 0%
amixer sset 'Beep' disable
# Set gdm not to use beeps with gconftool
gconftool-2 --direct \
--config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
-t bool -s /desktop/gnome/sound/event_sounds false
gconftool-2 --direct \
--config-source xml:readwrite:/etc/gconf/gconf.xml.defaults -t bool \
-s /apps/gdm/simple-greeter/settings-manager-plugins/sound/active false
# Set gdm not to use beeps with gsettings
gsettings set org.gnome.desktop.sound event-sounds false
gsettings set org.gnome.desktop.sound input-feedback-sounds false
# Another option is to run gconf-editor (as root), check the toggle box next to
# event_sounds off, right click on it and choose "Set as Default"
#
# Some other relevent gconf keys are discussed in the gdm manual:
# http://projects.gnome.org/gdm/docs/2.24/
- (711)Script to capture a demo of a running program
#recordmydesktop
# the target to capture
#--windowid <get it with xwininfo>
# if working with awesome
#--no-wm-check
# for user interaction
#--pause-shortcut Control+Mod1+p --stop-shortcut Control+Mod1+s
# for sound
#--device /dev/audio0 --no-sound / --s_quality <-1-10>
# for video
#--v_bitrate <45000-2000000> --v_quality <0-63> --fps <~25.0?>
# optimization/speed up capture?
#--on-the-fly-encoding
# needed in some cases
#--no-cursor # remove cursor from video
#--delay n[H|h|M|m] # before start of capture
WID=`xwininfo | grep "Window id" | cut -d':' -f 3 | cut -d' ' -f2`
#recordmydesktop --no-wm-check --no-sound --windowid $WID --on-the-fly-encoding -fps 2.0 --v_quality 25
recordmydesktop --no-wm-check --s_quality 2 -device /dev/sound0 --windowid $WID --on-the-fly-encoding -fps 2.0 --v_quality 25
- (712)Script to run compiz
## conftool-2 -s '/apps/metacity/general/compositing_manager' --type bool true
#metacity --replace
compiz ccp --sm-disable --replace
emerald --replace
- (716)Name of the Gnome network applet
/usr/bin/nm-applet
- (734)What to do in case of "X11 connection rejected because of wrong authentication."?
It generally occurs when you connect via SSH to a machine then switch user there. The tunneling of the Xorg connexion is not assured. You have to transmit the authorization granted to the primary user to the secondary user:
user1@machine$ xauth list
fileserver/unix:10 MIT-MAGIC-COOKIE-96951c0622f80fd52186129dd06f2f6
Next, sudo/su to the other account and add the authorization key.
user1@machine$ su - user2
user2$ xauth add fileserver/unix:10 MIT-MAGIC-COOKIE-96951c0622f80fd52186129dd06f2f6
Now, you should be able to start any X Windows application,
user2$ xclock
- (761)How to prevent Gnome to auto-open CD/DVD?
Panel Menu -> Preferences -> File Management
From: http://superuser.com/questions/417081/how-to-get-gnome-to-open-cd-automatically
- (766)Where are stored the associations files<->opening application for MATE (Gnome2)?
.mateconf/desktop/mate/applications/*/%mateconf.xml
- (799)How to enable/configure MultiMedia keys?
1. Install xbinkeys
2. Edit ~/.xbindkeysrc
3. The format of a single entry is:
# Comment
"<command to run on press>"
<keycode>
To get an entry generated automatically for you, run the following command:
xbindkeys -k
From: https://wiki.archlinux.org/index.php/Xbindkeys
- (800)How to enable/disable Emulate3Buttons with XInput [Ubuntu 12.04]?
--- enable
#!/bin/sh
xinput list | sed -ne 's/^[^ ][^V].*id=\([0-9]*\).*/\1/p' | while read id
do
case `xinput list-props $id` in
*"Middle Button Emulation"*)
xinput set-int-prop $id "Middle Button Emulation" 8 1
xinput set-int-prop $id "Evdev Middle Button Emulation" 8 1
;;
esac
done
--- disable
#!/bin/sh
xinput list | sed -ne 's/^[^ ][^V].*id=\([0-9]*\).*/\1/p' | while read id
do
case `xinput list-props $id` in
*"Middle Button Emulation"*)
xinput set-int-prop $id "Middle Button Emulation" 8 0
;;
esac
done
From: https://wiki.ubuntu.com/X/Config/Input#Example:_Disabling_middle-mouse_button_paste_on_a_scrollwheel_mouse
From: http://www.seebs.net/log/articles/459/disabling-emulate3buttons-on-ubuntu
- (813)How to set correctly the touchpad (Emulates3Buttons, VerticalScrolling, etc.) in Ubuntu 12.04?
1. Create a file /etc/X11/xorg.conf.d/touchpad.conf with the following content:
Section "InputClass"
Identifier "Touchpad" # required
MatchIsTouchpad "on" # required
Driver "synaptics" # required
Option "MinSpeed" "0.5"
Option "MaxSpeed" "1.0"
Option "AccelFactor" "0.075"
Option "TapButton1" "1"
Option "TapButton2" "2" # multitouch
Option "TapButton3" "3" # multitouch
Option "VertTwoFingerScroll" "1" # multitouch
Option "HorizTwoFingerScroll" "1" # multitouch
Option "VertEdgeScroll" "1"
Option "CoastingSpeed" "8"
Option "CornerCoasting" "1"
Option "CircularScrolling" "1"
Option "CircScrollTrigger" "7"
Option "EdgeMotionUseAlways" "1"
Option "LBCornerButton" "8" # browser "back" btn
Option "RBCornerButton" "9" # browser "forward" btn
EndSection
2. Run dconf-editor from your user (don't sudo). Go to org.gnome.settings-daemon.plugins.mouse, uncheck active. (It is a known issue that Gnome's Settings Daemon may override your xorg.conf settings).
3. Log out and log in. Things should be working fine now.
From: http://askubuntu.com/questions/12435/how-do-i-restore-two-finger-middle-click-again
- (255)difference Proba / Fuzzy
- en proba, on est soit vrai soit faux. En fuzzy on peut être vrai ET faux en même temps
- proba disent "Je crois à X% que le fait Z est vrai. Mais, dans le monde réel, Z ne peut être que vrai XOR faux (la vérité absolue dans le monde est vrai/faux, mais l'agent peut avoir des croyances subjective sur le monde)". Fuzzy dit "Dans le monde réel, Z peut être plus ou moins vrai ou faux (la vérité absolue est fuzzy, l'agent "possède" la vérité absolue)"
- (97)How to be a candidate to a teaching and research position in France
1. Use ANTARES/ANTEE to get the published jobs.
(being member of young researchers associations and subscribing to lots of mailinglist also helps)
2. Call the names / send emails to the names given
a. prepare a mail for teachings, with a synthetic view of what you did: audience, durations, domains, type: Lectures/Pratical works, investment in material and organization, etc.), link to synthetic tables on you web site, and complete description on your website
b. prepare a mail for research activities with a synthetic view of what you did, the places you where, the names of famous people that supervised you. Talk about research and projects you are involved in. Link to the complete work on your website, link to the list of your publications on your web site. Add a word about your openness towards participating into projects and your mobility.
Tip:
- the teaching contact is the one called "Directeur du département XXX"
- the research contact is the one called "Directeur du laboratoire XXX"
3. Send an application file
- must contains: short CV, list of publications, section on past teachings, section on past research, section on administrative tasks and responsibilities. Add a section about your integration with the teaching team, idem with the research team.
-
- remember to facilitate the work of the reader : give tables of teachings by year, by type (Lecture, etc.) and by domain (groups: basics, classical, with link to research domain)
4. If you are selected for an audition, get your laptop, a copy of the slides on paper for overhead projector, on USB key and on URL. Prepare paper copies for the jury.
- (110)How to review a paper
Most of the automatic reviewing processes have their own evaluation criteria. Remember to use the given criteria if it is your case.
Otherwise, a complete form should contain the following fields (it is
inspired from seral forms found on the web):
- About the reviewer
-> Reviewer's name
-> Reviewer's confidence: High / Medium / Low
- About this review
-> Authors: list the authors.
-> Title: give the title of the paper.
-> Abstract: in a few sentences, explain (in your terms what the paper) is about.
-> Final evaluation: accept paper with no modification / with minor modifications / with major modifications / accept as short paper / reject paper
-> Arguments: give arguments for the final decision (advantages and drawbacks of the paper)
- General Remarks
->Significance:
* Does the paper correspond to the conference's CFP?
* How important is the work reported?
* How difficult is the problem it adresses?
* What lesson(s) does the paper offer the scientific community?
-> Originality:
* To what extent is the reported work new?</LI>
* To what extent are the techniques, methods, or findings new?
* To what extent does the paper discuss relevant research?
-> Correctness (more adapted for theoretical papers): is the paper technically sound?
-> Positioning: is the paper well positioned with respect to the current state of the art?
-> Evaluation of the results (more adapted for papers with applications):
* Do the authors carefully evaluate their approach through systematic experiments, theoretical analysis, or some challenging, application-specific demonstration?
* Does the evaluation result in compelling evidence for performance gains over alternative approaches, psychological validity, and/or practical utility?
-> Clarity:
* Does the paper describe the method(s) in sufficient detail for a reader to replicate the work?
* Does it describe the inputs, outputs, and the procedure(s) employed?
* Is the paper well written and organized?
- Detailed domments:
-> Give page and line references
-> Give precise bibliographical references
- (248)How to recruit an internship (apprenti @ CEA)
The job interview can be splited into 3 part, which help prevent blank in communication and make the candidate confortable:
Phase 1. Present briefly the enterprise/lab
Phase 2. Ask question about the Curriculum
Phase 3. Present how the job is supposed to take place (se dérouler)
Phase 1
=======
- Present (10 slides max) the enterprise/lab and projects
e.g. - HUMAN RESOURCES: We are composed of X divisions, ours is the Yth, with Z billions euros budget and K persons working together, etc.
- SCIENTIFIC CONTENT: We are doing AI: research/modelling and development/softwares
- APPLICATIONS: The models we develop are applyed on different domains: health, energy, etc.
- Note the behaviour of the candidate: is s/he pro-active, asking questions? Does s/he show interest (or, at least, that he follows the discussion)? Is s/he too relax and almost sleeps?
- END WITH : Do you have any question on the entreprise or projects you have seen?
Phase 2
=======
- If there are any ambiguities/holes in the Curriculum, then ask for explanations. And observe reactions/answers of the candidate when s/he answers.
- For the subject of interest (e.g. "Programming"), ask questions about
- The origins of the motivation (e.g. "When did you start being interested in computer science?", ask more about the hobbies: do they include geek stuff? cite several areas of interest - e.g., those of computer science: systems, networks, databases, security, programming, software design, etc.- and ask which ones are the ones that the candidate prefers)
- The practical competences (e.g. "What are the languages you know? Which one do you prefer? Would you be interested/reluctant to use another one?")
- The theoretical competences (e.g. "Did you use any design/software engineering methodologies (like UML) in your projects? Did you write yourself the specifications/cahier des charges? Were your interactions with your bosses formal (specifications) or rather informal (mainly oral/friendly interactions)?")
- Understand if the candidate is able to work in Team and/or Autonomously
- Ask whitin the previous school-projects and interships if s/he has been taken to work with others or if s/he worked alone.
- Ask for the sizes of the teams s/he worked in
- Ask for his/her role in the team
- Ask if the interactions within the team were rather formal (write specifications) or informal (mainly oral interactions in a P2P fashion)
- Ask if s/he used revision control systems
- Ask how the candidate organized him/her-self during these works (see if s/he pronounce the keyword "gantt diagram")
- Ask what is the future/final job that the candidate would like to have (e.g. see if there is a problem, like s/he wants to be researcher while applying for an industrial internship)
- Test if the candidate has abilities in English (TOEIC, TOEFL, speak directly in English, etc.)
- Note the behaviour of the candidate: is s/he pro-active, asking questions? Does s/he show interest (or, at least, that he follows the discussion)? Is s/he too relax and almost sleeps/yaws/makes annoyed noises? Does the candidate show timidity: does s/he look the interviewers in the eyes? Does s/he shake?
- END WITH : "Did/Do you have any other job interviews?". That might provide an idea about: if other companies were interested in his/her profile (not so much other job interviews), to see if the candidate will available rapidly (not so much other job interviews), if the candidate is motivated by this particular offer (or s/he is broadcasting)
Phase 3
=======
- Explain how would the job take place if the person is recruited
(e.g., "You will have 3 missions, one each year". "First we will introduce you to the programming language we use, using Labs-TP-likes exercices, then we will give you a mission that we will supervise, then a mission not supervised, to provide you with more and more autonomy", etc.)
- Explain the local work conditions (below examples are more specific to CEA):
-> There are XXX hollidays per month
-> You have YYY compensations for lunch
-> You'll have full and unique access to an office and computer, etc.
-> You'll be considered as a full member of the team, don't hesitate to ask questions to anyone
-> The work day starts at XXX and spans YYY
-> You get a compensation of XXX for taking the bus to go to work/ You can access the "campus" thanks to private bus lines
-> The earnings are YYY, depending on (age, diplomas, etc.)
-> You have access to a (good) "mutuelle" / social&sports associations
-> The team is young and the atmosphere sympatic
-> Explain how the previous interships took place and forward feedback for the previous candidates (e.g., lunch is cheaper than anywhere else, etc.)
- END WITH : Do you have any questions?
- Tell the candidate that you'll see other candidates and when you think you'll be able to give the partial (e.g. ranking)/final answer.
- For CEA: don't forget to sign the badge for the candidate to be able to get out of the "campus".
======================================================================
The final grid to evaluate:
- Motivation: .../5
- Technical competences: .../5
- Team-work: .../5
- Behaviour during interview: .../5
- School notes/ranking: .../5
- Others: external +/- recommandations, etc.
- (319)How to write/review an introduction?
- Context
1. "In the domain of A, researchers have often worked on X, Y and Z [refs]..."
2. "<Description of an application domain>[ref]..."
- Problem (+ relavance & importance to the community)
1a. "...However, nobody has ever worked on K. K is important because it is complementary to X, Y and/or Z..."
1b. "...However, nobody has ever worked on K. K is important because X, Y, and/or Z rely on K to be applicable/feasible..."
2. "...When applying methodology X to this application domain, problems X, Y and Z arise. These problems are new to the community of X, because R, and are interesting since no trivial solution exists [refs]. Here we will focus particularly on Y".
- Methodology
1. "Based on AI's original principle "divide-and-conquer", we sub-divide our main problem into the following simpler sub problems..."
2. "In order to address this problem, we first do X, then Y, and finally Z..."
- Contribution
1. "The main contribution of this paper relies in the definition/formalization of..." [more theoretical contribution]
2. "In this paper we presents results that tend to show that..." [more practical contribution]
- (346)Home Automation Protocols
USHARE, XBMC ou MiniDLNA
- (471)How to do Machine Learning on Big Data?
Je crois qu'on va bientôt commencer à parler de "Big Data"... (j'ai
entendu parler de 300 Go de données pour un seul avion...)
Google, Facebook, Amazon & co utilisent Hadoop pour gérer leurs rivières
de données (Google a sa propre version codé en C++).
http://hadoop.apache.org/
En deux mots c'est un framework où l'on utilise des ordinateurs
conventionnels (un data center) et où la donnée est répartie sous forme
de "cluster" (des paquets de 64 ou 128 Mo en général). Le grand intérêt
de hadoop est de s'appuyer sur un algorithme s'appelant MapReduce. C'est
un principe où quand une tâche de calcul est à effectuer, elle est
"mappée", c'est à dire transformée en autant de sous-taches sur tous les
clusters concernés. Ensuite chaque résultats de chaque taches est
"réduite", c'est à dire aggloméré dans un résultat final.
Exemple : Tâches "Moyenne des temps de vol".
--> se mappe en "Calcul de la moyenne des temps de vol dans chaque
cluster de donnée"
--> résultat : un couple (Somme, NbVol)
--> Opération de reduce : Resultat = (Somme1 + Somme2 + ...) / (NbVol1 +
NbVol2 + ...)
En fait, dans le framework Hadoop, le code compilé et la donnée
"attaquée" sont dans la même machine, c'est ceci qui évite le goulot
d'étranglement de l'accès aux données.
Autres avantages, les clusters de données se dupliquent tout seul (en
général en 2 ou 3 exemplaires, c'est configurable) ce qui rend le data
center robuste aux crashs des machines. Personne n'a jamais perdu ses
données personnelles chez Google jusque là...
Sur le framework, des projets très intéressants (open source) se sont
mis en place. Par exemple, Cassandra est un projet qui permet d'obtenir
globalement les mêmes services qu'une base de données. Autre projet,
Mahout, propose une bibliothèque d'algorithmes de Data Mining et de
Machine Learning sous une forme MapReduce. La liste d'algo est ici :
https://cwiki.apache.org/confluence/display/MAHOUT/Algorithms
From: Stéphane
- (531)"Correlation does not imply causation" "Cum hoc ergo propter hoc"
Deux cyclistes arrivent de front. Ils doivent s'éviter. Ils peuvent chacun prendre la décision d'aller soit à droite, soit à gauche, soit tout droit. Ils ont un accident, se rentrent dedans.
- L'accident et les décisions des cyclistes sont liés par un lien de *corrélation*,
mais
- L'accident n'est pas la cause des décisions des cyclistes. Ces deux événements ne sont *pas* lié par un lien de *causalité*.
http://www3.ac-clermont.fr/etabliss/stael/ses/spip.php?article21
Il y a statistiquement plus de cyclistes dopés dans le Tour de France que dans les autres courses nous révèlent apparemment les observations, faut-il en conclure que ce sont les organisateurs du Tour qui obligent les coureurs à ce doper ?!!!
http://cyberzoide.developpez.com/opinions/index.php3?page=stat
C => A et C => B alors A&B corrélés mais A&B sans lien de causalité. Penser au cas de faits de la vie courrante complètement indépendants que des enquêtes médicales stupides relient par des liens de causalité au lieu de corrélations.
- (562)Cool news & mailing-lists sites
- PhD Guides:
http://cjc.jeunes-chercheurs.org/expertise/
http://guilde.jeunes-chercheurs.org/Alire/guide/
http://www.uq.edu.au/student-services/phdwriting/index.html
- CS/IA/SMA Mailing lists
http://www.afia.asso.fr/tiki-index.php?page=Petites+Annonces
http://www.irit.fr/GRACQ/rubrique.php3?id_rubrique=19
http://www.irit.fr/GDR-I3/Abonnement.html
http://email.essi.fr/mailman/listinfo/specif-forum/
http://www.loria.fr/~chevrier/ListeSMA.html
http://lists.cs.umbc.edu/mailman/listinfo/agents/
http://www.csee.umbc.edu/csee/research/kqml/misc/dailist.html
- SMA sites
http://turing.cs.pub.ro/auf2/html/chapters/chapter1/sommaire.html
http://www.agentlink.org/index.php
http://www.damas.ift.ulaval.ca/~jlaumoni/recherche-sma-n-nonchercheurs1.php4
http://multiagent.com/
- Robots
http://www.automatesintelligents.com/
http://www.ledroideenchaine.com/
http://www.robot-intelligence-artificielle.com/
http://robots.net/
http://shyrobotics.com/
http://www.zonerobotique.com/
http://www.generationrobots.com/boutique/index.cfm
- Science News
http://interstices.info/jcms/jalios_5127/accueil
http://ercim-news.ercim.eu/
http://www.bulletins-electroniques.com/
- (563)Cool sites & books
- Java
http://mindprod.com/jgloss/jgloss.html
http://www.faqs.org/faqs/computer-lang/java/programmers/faq/
http://www.jmdoudoux.fr/accueil_java.htm
- Caml
http://www.faqs.org/faqs/meta-lang-faq/
- C
http://www.faqs.org/faqs/C-faq/faq/
- C++
http://yosefk.com/c++fqa/index.html
http://www.faqs.org/faqs/C++-faq
- CVS
http://cvsbook.red-bean.com/cvsbook.html
- SVN
http://svnbook.red-bean.com/
- GIT
http://git-scm.com/book
- R
http://journal.r-project.org/
http://www.statmethods.net/
http://addictedtor.free.fr/graphiques/
http://www.aphysicistinwallstreet.com/2011/11/free-books-for-r.html
http://rwiki.sciviews.org/doku.php?id=tips:tips
http://rwiki.sciviews.org/doku.php?id=guides:guides
http://rgm2.lab.nig.ac.jp/RGM2/images.php?show=all&pageID=2194
https://en.wikibooks.org/wiki/Data_Mining_Algorithms_In_R
- IA
http://www.faqs.org/faqs/ai-faq/general/part1/preamble.html
- LaTeX
http://www.faqs.org/faqs/tex-faq/
http://www.faqs.org/faqs/fr/faq-latex-francaise/part1/
- Tikz
http://www.texample.net/
- OpenBSD
http://www.faqs.org/faqs/386bsd-faq/part1/
http://openbsd.org/faq/index.html
- Linux
http://www.faqs.org/faqs/linux/info-sheet/
- Bash
http://tldp.org/LDP/abs/html/
- GNU Make
http://www.gnu.org/software/make/manual/make.htm
- Liste de bookins IA
Agent Intelligence Through DataMining 0387243526.pdf
ArtificialIntelligence3rdEdModernApproachRussell.pdf
G.Weiss - Multiagent systems - a modern approach to distributed artificial intelligence.pdf
LesSMA_Ferber.pdf
OReilly.Programming.Collective.Intelligence.Aug.2007.pdf
Prentice Hall - Artificial Intelligence - A Modern Approach 2ed.djvu
Prentice Hall - Artificial Intelligence - A Modern Approach 2ed.pdf
Russel - Artificial Intelligence - A Modern Approach 2ed.pdf
Russel - Artificial Intelligence - A Modern Approach 3ed.pdf
The Agent-Oriented SW Eng Handbook.pdf
Wiley - An Introduction To Multiagent Systems [Wooldridge].pdf
ebooksclub.org__Collective_Intelligence_in_Action.pdf
jade_book.pdf
- (588)A few cool lectures on MAS
Cours en-ligne "Agents Intelligents"
http://turing.cs.pub.ro/auf2/index.html
----
Chapitre 6 - Logique de connaissance et de croyance
http://www.bj.refer.org/cours/coursenligne/autres_cours/agentintel/cours/apprenant/chapitres/chapitre6.htm#6.3
- (590)What are Asimov's three rules for robots?
1. Un robot ne peut porter atteinte à un être humain, ni, restant passif, permettre qu'un être humain soit exposé au danger.
2. Un robot doit obéir aux ordres que lui donne un être humain, sauf si de tels ordres entrent en conflit avec la Première loi.
3. Un robot doit protéger son existence tant que cette protection n'entre pas en conflit avec la Première ou la Deuxième loi.
- (620)How to get the impact factor of confs/journals?
http://www.adaptivebox.net/CILib/CICON_stat.html
Journal Citation Reports / Impact Factor
http://www2.lib.udel.edu/colldev/impact.htm
- (622)Basic questions to ask at the end of a presentation?
1. S'il fallait refaire, tu referais pareil ou changerais ? Tu changerais quoi ?
2. S'il ne fallait retenir qu'une seule chose ce serait quoi ? / Quelles sont tes contributions majeures ?
- (630)How to prepare/pass a job interview?
- Choses à penser avant l'entretien
-> Se renseigner sur l'entreprise (buts, thèmes, etc.)
-> Se renseigner sur la/les personne/s de contact
-> [Recherche] Contacter les futurs collègues
-> Noter le nom et la position de la personne
-> Noter le téléphone de la personne de contact
-> Noter l'adresse du lieu + Imprimer un plan
-> Confirmer les rendez-vous
- Pour répondre
-> Attention au vocabulaire
-> Donner des exemples
-> Rester toujours positif
-> si question touche point difficile => dire que "il arrive que" (diminuer effet temporel) ou "on dit de moi que" (diminuer portée)
-> Parler en termes de réalisations
-> Sourire
- Ce que je peux apporter à une entreprise/labo:
-> Compétences en SMA et plus généralement IA
-> Compétences générales en info (Admin Système/Réseau, gestion site web...)
-> Compétences en gestion de projet
-> Relations internationales (Brésil, Espagne, Luxembourg, etc.)
- Se présenter ?
-> faire court (1 ou 2 minutes) / description rapide puis détails
-> cibler par rapport à l'entreprise/labo => parler des réalisations !
-> montrer qu'il y a une cohérence dans le projet de carrière
-> Exemple :
- Passionné d'info depuis bien avant le Bac
- => cursus informatique jusqu'à maîtrise à Paris XI
- découverte IA/SD, volonter de mélanger les 2 + intérêt bio (apport dans les 2 sens)
- => DEA (IARFA) à Paris VI avec but Vie Artificielle
- découverte des SMA, qui mélange tous les intérêts ci-dessus AI+SD+Bio
- => Thèse EMSE dans ce domaine
- dévpt 2 axes : communication agents / organisation (normes) / confiance-Rp
en + : ART-testbed
- poursuivi ses axes dans différents postes (ATER, "post-doc")
-> ESIL Marseille : modèles confiance, moteur recherche Web2
-> LORIA, 2 parties :
1. modélisation organisationnelle, système aérien
2. startup IntuitieMachine : assistant domestique intelligent et communicant
- ["élargissement à l'IA"] maintenant plus apprentissage
-> Brésil : création de joueur virtuels par apprentissage sur traces jeux réels
-> AiRPX : fouille de masses de données pour maintenance prédictive/détection pannes avions
-> mais en restant SMA, CEA : optimisation gestion énergie dans maisons solaires / décentralisation logique floue / modularité, remplacement appareil
- Mes domaines de compétence
-> Technique / AdminSys / Logiciels libres
- SMA : MadKit, Jade, Jason, MAST
- Web : HTML, XML, PHP, MySQL
- Développement : R, Java, C, C++, C#, Prolog, Caml, Pascal, assembleur, bash, Basic, Perl
- Génie Logiciel : UML, fusion
- Éditeurs : Eclipse, XEmacs, MonoDevelop, Visual C# & C++, vi
- Bureautique : LaTeX, OpenOffice, Microsoft Office
- Administration : Hadoop, IPCop, OpenVPN
- Logiciels et bibliothèques : CVS/SVN/Git, Weka, Gnuplot, GNU make, OpenGL, MPI/PVM
- OS : Slackware/ArchLinux/Ubuntu, OpenBSD, Windows 98/XP/7
-> Intelligence Artificielle : SMA, Clustering (KMeans, XMeans, EM, SOM, DBScan, LVQ, Mahalanobis), Classification (SMO, MLP, J48, RandomForest, HMM), Régression (régression linéaire, SMO, MLP, REPTree, ZeroR), Prise de Décision (Fuzzy Logic, Algorithmes Génétiques{}, Programmation Génétique)
-> Informatique : Simulation, Systèmes Distribués, Sécurité Réseau, Big Data, Tests Statistiques, Développement Logiciel
- Mes domaines applicatifs
-> Épidémiologie
-> Peer-to-peer
-> Web 2.0
-> Air Trafic Management
-> Domotique
-> Sérious Games
-> Natural Resource Management
-> Maison Solaire Termique
-> Air Fleet Management
- Comment gérez-vous les personnes avec qui vous ne vous entendez pas ?
-> Je m'entends avec tout le monde
-> Il est arrivé que je ne m'entende pas avec mon directeur de thèse => au final très bien passé
-> Il est arrivé au CEA avec supérieure => Stratégie : comprendre pb / rechercher la source => langage
- Qu'est-ce qui vous déplaît dans votre travail ?
-> Pas le temps de tout faire : plein de projets quand croise autres chercheurs en conférence.
-> Pas de résultats concrets
- Avez-vous déjà eu une déconvenue au travail ?
-> À l'ESIL, difficile de trouver collègues pour travailler en local => projet international ART
-> Pas de résultats concrets en fin de thèse.
- 3 Qualités [Mnémotechnique: A-P-E=Autonomie+Précision+Équipe]
-> Travail en équipe [ART-testbed: ]
-> Travail en autonomie [ESIL: pas de collègues]
-> Précision
-> Pédagogie
-> Organisation
-> Communication Orale et Écrite
-> Curiosité scientifique
- 3 Défauts [Mnémotechnique: =]
-> Hyperactif: mes collègues/amis me trouvent généralement Hyperactif (bcp sports, peu vacances). Je ne supporte pas de ne rien faire. Si pas d'activités/projet => je m'en crée.
-> Bavard : il arrive que l'on dise de moi que je suis Bavard, mais c'est surtout une bone façon d'amener les autres à parler d'eux et à créer des liens sociaux / projets
-> Perfectionniste: Il m'arrive d'être trop perfectionniste. C'est mon côté scientifique : Rigueur/Précision. Mais je sais être pragmatique quand il le faut. Exemple : correction orthographe des élèves.
- Pourquoi vous êtes intéressé par cette offre ?
-> Bien sûr, premièrement car il correspond à mes compétences actuelles (au que je souhaite acquérir)
-> Grand groupe :
- Qualité de vie (associations sportives et culturelles)
- Pérénité/Cadre d'évolution (moyens: poste travail, conférences, etc.)
Petite structure :
- Taille humaine
- Flexibilité
-> Challenge intellectuel
-> Mélange Recherche / Industriel : applications concrètes des travaux
- 3 Critères de choix final
-> Lien R&D + conception
-> Résultats concrets
-> Correspondance tâches affectées au poste / mes désirs/compétences
-> Localisation home/travail
-> Ambiance (futurs collègues)
- (831)Websites to read for persons strating/ending a PhD
- J'avais bcp aimé ce site (surtout la FAQ) à la fin de ma thèse quand je me suis posé pas mal de questions pour savoir si je devais finir ma thèse ou pas... Depuisje le conseille à tous les doctorants que je croise
http://www.uq.edu.au/student-services/phdwriting/index.html
- Et puis les mêmes personnes ont fait un guide de rédaction que j'imagine aussi très bon :
http://www.phys.unsw.edu.au/~jw/thesis.html
- Un site plus général sur la rédaction en Français
http://www.assoabcd.fr/images/info/Ressources/typo.html
http://gargas.biomedicale.univ-paris5.fr/lt/typo.html
- Et plus généralement, sur le avant/pendant/après une thèse en France.
http://guilde.jeunes-chercheurs.org/Alire/guide/
- (869)How to make a better presentation?
En plus d'apprendre les 2/3 premiers slides par cœur afin de ne pas hésitailler et d'en profiter pour regarder le jury dans les yeux, vla 2/3 trucs que j'avais appris :
- Faut bien penser à prendre le public par la main au début (c'est à l'orateur d'amener le public de là où il est à là où il veut)
- Surtout faut pas speeder (compresser les 1h++ en 45min, c'est toujours faisable en parlant vite...). Au contraire, pour pas perdre les gens, faut parler lentement et pas hésiter à reformuler plusieurs fois (en utilisant des expressions style : "autrement dit", "en d'autres termes", etc. pour que ce soit explicite pour le spectateur).
- Y'a un truc pas mal aussi pour se forcer à faire des pauses et à prendre du recul, c'est d'écrire le méta-discours dans les commentaires des slides (pour chaque slide, tu mets une phrase qui dit d'où on vient, la nouvelle idée que le slide apporte et où l'on va) et de reprendre régulièrement ce méta-discours à l'oral (sans forcément afficher un plan ou un slide particulier). Régulièrement (genre tous les 2/3 slides, là où une sous-partie se termine), tu dis un truc du genre "dans les 2 derniers slides on a vu XXX, maintenant on va voir YYY".
- 1 idées par slide/paragraphe
- regarder le public
- Apprends les 2/3 premiers slides par cœur (pour ne pas paraître hésitailler et pour te lancer. Une fois parti en général le discours se déroule tout seul)
- Prends le public par la main (c'est à toi d'amener le public de là où il est à là où tu veux)
- Regarde bien différentes personnes du public (pour voir si elle suivent et pour que ta voix porte bien vers eux)
- Parle lentement (compresser les 1h++ en 45min, c'est toujours faisable en parlant vite...) et n'hésites pas à reformuler plusieurs fois
- Reprends régulièrement le méta-discours à l'oral (pour chaque slide, tu peux noter dans les commentaires une phrase qui dit d'où on vient, la nouvelle idée que le slide apporte et où l'on va). Tous les 2/3 slides, tu peux dire un truc du genre "on était dans le cadre XXX, on vient de voir YYY, maintenant on va voir ZZZ".
- (101)Moving from one home to another
- Banques : socgen / BICS / Nef / Crédit Coopératif
- Impôts : https://www.changement-adresse.gouv.fr
- Carte grise
- Assurances : MGEN / MAIF
- Courrier : LaPoste
- Militaire : https://www.changement-adresse.gouv.fr
- EDF : https://www.changement-adresse.gouv.fr
- Assedics : https://www.changement-adresse.gouv.fr
- Magasines : MISC / canard
- Listes électorales
- Employeur : LORIA-paie
- Passeport / CNI
- Noter compteur eau/gaz/électricité
- (CAF / écoles, si on a des gamins)
- Commandes & livraisons : Play-asia
- (122)Loi de Murphy
"Loi de l'emm... maximum (LEM). « S'il y a deux façon de faire quelque chose, et que l'une d'elles conduit à une catastrophe, alors quelqu'un le fera ». C'est la version originale de Edward A. Murphy, Jr. ingénieur au projet MX981 de l'USAF (US Air Force), chargé de tester la tolérance humaine à l'accélération. Il y avait 16 accéléromètres pouvant être montés de deux façons différentes, et quelqu'un les brancha tous méthodiquement à l'envers..."
Source: http://www.linux-france.org/prj/jargonf/M/Murphy.html
- (123)La loi de Godwin
"Plus une discussion sur l'Usenet est longue, plus la probabilité d'y trouver une comparaison avec les nazis ou Hitler approche de un". Il est de bon ton de clore immédiatement une discussion lorsqu'on rencontre une telle comparaison, qui tient de l'insulte : celui qui la fait n'a plus d'argument valide, il a perdu. Au passage, il a gagné un point Godwin. Évidemment, cette loi ne peut en aucun cas être invoquée dans une discussion, car cela reviendrait très précisément à faire la même chose que l'insulte qu'elle prétendrait dénoncer, en cherchant à jeter le discrédit sur l'interlocuteur...
Source: http://www.linux-france.org/prj/jargonf/G/Godwin.html
- (188)How to behave when interviewed (French)
http://www.lestrucsdunjournaliste.com/2009/09/comment-se-comporter-en-interview-1.html
http://www.lestrucsdunjournaliste.com/2009/09/comment-se-comporter-en-interview-2.html
- (198)Where to find some sheets to organize yourself (à la "GTD" from David Allen)
http://www.diyplanner.com/templates/official/classic
- (232)Material to bring to a rollerskate competition
- Obligatoire : casque, carte d'identité, un peu d'argent mais pas trop, le T-shirt officiel de l'équipe, banderole de l'équipe, 4/6 épingles pour accrocher le dossard
- Course : chronomètre/montre
- Matos bricolage : Clef Allen(lines)/Clef 8 (quads), tournevis, couteau suisse avec scie métaux, ficelle (pour relai)
- Pharmacie : Sparadrap/Pansements/Compeed + crème solaire + amplâtre américain
- Hygiène : 1 rouleau de papier toilettes/sopalin/mouchoirs, ongles de pieds bien coupés
- Vêtements : Pull + K-way + lunettes
- Bouffe : bananes, barres de céréales, biscuit "petit déj", chocolat, sandwiches, pâtes (sucres rapides et sucres lents, mais pas trop de gras)
- Boisson : coca (GM: 4l pour 6 heures), eau, sirop, jus fruits, café/thé (pas trop)
- Camping : Sac de couchage, glacière, chaises, table, tente
- (246)List of FOSS development tools
- C++ : code::Blocks http://www.codeblocks.org/
- Java, C++ : Eclipse http://www.eclipse.org/
- C# : monodevelop http://monodevelop.com/
- (329)What is the difference between "Salaire Brut" and "Salaire Net"?
Salaire Net = salaire qu'on touche vraiment (impôts déduits)
Salaire Net == 77% Salaire Brut
- (345)Free Software promotion sites
> > "1540 logiciels libres dans l'annuaire Framasoft"
> > http://www.framasoft.net/
> >
> > FramaDVD Ecole
> > http://framadvd.org/framadvd_ecole.php
:
http://www.tice.ac-versailles.fr/logicielslibres/
Logiciels libres et enseignements
http://www.educoo.org/
Contenu pédagogique libre
http://fr.wikipedia.org/wiki/Ressources_%C3%A9ducatives_libres
Ressources éducatives libres
U
> >
-----------------------------------------------------------------------
> > Musique
http://www.boxson.net/
Diffusion et hébergement de musique sous licences libres (licences
Art-Libre ou Creative Commons).
http://www.dogmazic.net/
Diffusion et hébergement de musique sous licences libres (licences
Art-Libre ou Creative Commons)
http://altermusique.org/
Altermusique.org est un label de musique libre. Production, diffusion et
promotion d'artistes qui ont choisis d'ouvrir leur musique à leur public.
http://www.revolutionsoundrecords.org/
L?association «collectif Revolution Sound Records (RSR)» est née du
désir et de la volonté d'artistes de rendre la culture libre et
accessible à tous, désireux de permettre au public de découvrir
gratuitement et légalement les oeuvres d'artistes non standardisés.
http://www.oxyradio.net/
Webradio libre, musique et émissions
---------------------------------------------------------------------
Livres :
http://www.framabook.org/
Une collection de livres libres sur le logiciel libre
http://www.inlibroveritas.net/
Lire et écrire librement
http://fr.wikibooks.org/wiki/Accueil
La bibliothèque de livres pédagogiques libres que chacun peut améliorer.
http://www.gutenberg.org/browse/languages/fr
Le projet Gutenberg
http://petits-venusiens.be/site/
Conte pour tous petits, sous LAL, à lire et colorier, disponible en 15
langues !
http://www.audiocite.net/
Catalogue de livres audio à télécharger gratuitement et légalement :
Roman, nouvelle, poème d'auteur classique ou contemporain.
-----------------------------------------------------------------------
Vidéos :
http://www.kassandre.org/
Kassandre réunit les cinéastes ayant fait le choix de partager librement
leurs créations (licences Art-Libre ou Creative Commons)
http://entropy.tuxfamily.org/
Films uniquement sous licence libre
http://www.open-video.org/
Vidéos libres de droits indexées par thème (histoire, education...)
durée, format, couleur etc.
-----------------------------------------------------------------------
Photos/Créations graphiques :
http://www.openclipart.org/
Collections de dessins vectoriels (Creative Commons, licence Art Libre,
domaine public)
http://www.flickr.com/creativecommons/
Photos, créations graphiques sous Creative Commons
-----------------------------------------------------------------------
Divers :
http://artlibre.org/
Indexation d'auteurs ayant opté pour la Licence Art Libre
http://fr.creativecommons.org/
Moteur de recherche et publication d'oeuvres sous Creative Commons.
http://www.sites-cc.infini.fr/index.php/Accueil
Liste de 500 sites francophones sous Creative Commons ou licence libre.
Matériel libre :
http://fr.wikipedia.org/wiki/Mat%C3%A9riel_libre
Le matériel libre (en anglais open hardware) définit les ordinateurs et
le matériel électronique développés selon des principes de la culture libre.
-----------------------------------------------------------------------
Jeux :
http://live.linux-gamers.net/
Une distribution linux orientée jeux.
http://ultimateedition.info/
Ubuntu Ultimate Gamers Edition, une autre distribution orientée jeux.
http://www.jeuxlinux.fr/liste_des_jeux_licence.html#Libre
Liste de jeux libres
http://asso.lanpower.free.fr/
Création et diffusion de compilations de jeux libres et portable (sur
clé USB), organisation de Lan Party.
---
Ah oui, côté programmation, on peut mentionner Scratch, logiciel de
programmation pour les enfants à partir de 7/8 ans, développé par le
MIT. Le slogan étant "Imagine·Programme·Partage !" :
http://scratch.mit.edu/
Dans la même lignée, on peut également citer Squeak :
http://community.ofset.org/index.php/Squeak
---
Une partie triee et selectionnee est disponible sur ma page LL et education :
http://science.physique.free.fr/softs/
- (347)List of sites to DL books/music/movies/softs...
http://www.ebooksbay.org/
http://www.filestube.com/
http://library.nu/ (gigapedia)
http://avaxhome.ws/
http://fileshunt.com/
http://rapidlibrary.com/
http://www.4shared.com/
http://gen.lib.rus.ec/ (library genesis)
http://www.ebooksgratis.it/ (fr)
- (348)List of WebComics for Geeks
http://www.phdcomics.com/
http://www.bouletcorp.com/blog/
http://xkcd.com/
http://danstonchat.com/
http://geektionnerd.net/
http://www.nojhan.net/geekscottes/index.php?strip=0
http://lepiredup2p.blogspot.com/
http://www.userfriendly.org/
http://itmanagement.earthweb.com/cnews/article.php/3857336/Tech-Comics-The-Geek-and-the-User-part-2.htm
http://www.geekherocomic.com/2009/11/13/outside/
http://www.taoofgeek.com/
http://www.thewebcomiclist.com/browse.php?genre=5
http://geekandpoke.typepad.com/geekandpoke/
http://www.hypexr.org/comics.php
http://maliki.com/strip.php?strip=252
http://hackles.org/archives-2001.html
http://folk.uio.no/hpv/linuxtoons/
http://www.martybucella.com/cartoonstore.html
http://www.mikeshapirocartoons.com/main.php
http://folk.uio.no/hpv/linuxtoons/m-linux/
http://blog.admin-linux.org/geek/bd-de-geek-2
http://www.gocomics.com/?ref=comics
http://gucomics.com/comic/
http://darky-ben.fr/Xut/
http://www.joystiq.com/tag/webcomic/
http://aulas.pierre.free.fr/chr_fen_01.html
- (349)Sites for reading news about FOSS
http://linuxfr.org/
http://toolinux.com/
http://www.theopensourcerer.com/
http://www.planet-libre.org/
http://www.zeropaid.com/
http://tootella.org/
http://toolinux.org/Wikio-les-meilleurs-blogs-sur-les
http://www.generation-nt.com/
http://www.maitre-eolas.fr/
BSD:
http://www.gcu-squad.org/
http://www.undeadly.org/
http://bsdmag.org/magazine/
- (350)Sites for reading/listening to news of the world
http://www.listenlive.eu/france.html
http://www.rue89.com/
http://www.mediapart.fr/
http://lecanardenchaine.fr/
http://www.lemonde.fr/
http://www.folha.uol.com.br/
http://avaxnews.com/
- (351)Survival books
The Complete Worst-Case Scenario Survival Handbook.pdf
The_Worst_Case_Scenario_Survival_Handbook.pdf
SAS Survival Guide How To Survive Anywhere, On Land Or At Sea.pdf
The.Survival.Handbook.-.Essential.Skills.for.Outdoor.Adventure.pdf
US Army Special Forces Medical Handbook.pdf
SAS_Survival_Guide.pdf
The_Survival_Handbook.pdf
Wild Plants With Edible Tubers, Bulbs Or Roots.pdf
FM 21-76 US ARMY SURVIVAL MANUAL.pdf
- (407)Natural products that solve common problems?
Vinaigre blanc => contre calcaire
Econazole => contre les odeurs/bactéries dans les chaussures
Pierre Alun => contre transpiration et coupure de rasoir
Purin d'orties => contre les petites bêtes du jardin
- (496)Restaurants in Paris
- Discounts
http://www.lafourchette.com/
- Cosi [home-made bread filled with italian anti-pasti-like food - classical music]
54 Rue de Seine
75006 Paris
01 46 33 35 36
- Le Jardin des Pâtes [home-made italian/french noodles]
4 Rue Lacépède
75005 Paris
01 43 31 50 71
- Café de l'Industrie [french food]
16 Rue St Sabin
75011 Paris
01 47 00 13 53
- Scop Le Temps des Cerises["cantine" french food]
18 Rue Butte aux Cailles
75013 Paris
01 45 89 69 48
- Aux Délices du Liban [libanese food]
3 Rue Estrapade
75005 Paris
01 44 07 29 99
- Godjo [ethiopian food - unique plate shared by everyone]
8 Rue de l'École Polytechnique
75005 Paris
01 40 46 82 21
- Chez Gladines ["Basque" food]
30 Rue des Cinq Diamants
75013 Paris
01 45 80 70 10
- Les 5 Saveurs d'Anada [vegetarian/organic food]
72 Rue du Cardinal Lemoine
75005 Paris
01 43 29 58 54
- ?? [Very small&cheap "crèperie" owned&frequented by south americans]
34 Rue Mouffetard
75005 Paris
- Delibay [Chinese/Hong-Kong food]
121 Avenue Maine
75014 Paris
01 71 50 99 17
- La Papaye Verte [Thaï food]
4 Bis Rue Archange
91400 Orsay
01 69 29 93 02
Crèperie "Françoise"
7 rue de Ponthieu
75008? Paris
- [japanese food]
croisement rue Daguerre/av. du Maine
75014 Paris
- Restaurant Ile de la Réunion [food from reunion island]
96, rue Daguerre
75014 Paris
Le Goyavier [Reunion Island]
4, rue Saint-Bernard vers Faidherbe-Chaligny
http://www.restoaparis.com/fiche-restaurant-paris/le-goyavier.html
- Zen Zoo [Chinese?]
2 Rue Cherubini
75002 Paris
01 42 96 27 28
- Sukhothaï [Thaï food]
12 Rue Père Guérin
75013 Paris
01 45 81 55 88
- ?? [vietnamese food]
Rue lacépède/Place de la contrescarpe
75005 Paris
- Mansouria [Morocan - Tajine - very expensive]
11 rue Faidherbe
75011 Paris
- L'atelier
Inajiku [Japonais]
rue des Bernardins
[Japonais - Tonkazu]
rue de l'arrivée vers Montparnasse
Chez Josselin [crèperie]
vers rue de la gaîtée
La crèperie bretonne [crèperie]
vers rue de la gaîtée
Cassoulet
vers Parmentier
Lafitte (midi seulement)
Madeleine / Chaussée d'Antin
Falstaff [bar à bière]
39 Rue du Montparnasse, Paris
Académie de la bière [bar à bière]
88 Boulevard de Port-Royal, Paris
Le troll café [bar à bière]
27 Rue de Cotte, Paris vers Place Aligre
- (474)What plants can help for kidney stone?
Nigelle (candies)
- (475)What diet can help for kidney stone?
Aliments à manger moins afin d'éviter les calculs rénaux (ou les soigner)
Notons qu'il n'est pas interdit de manger les aliments suivants, seulement de les consommer en modération pour éviter d'augmenter la sécrétion de l'oxalate. L'idée de base reste, nous le répétons, de ne pas en consommer en quantités excessives. Pas tout le monde n'est concerné par ces conseils alimentaires non plus, ils sont surtout destinés à ceux qui sont prédisposés à développer des calculs rénaux.
1) Certaines boissons
La formation de lithiase rénale est favorisée par la consommation de grandes quantités de thé noir ou de thé glacé (haute teneur en oxalate), sodas (très acides) et bières (en boire trop augmente l'excrétion de l'acide oxalique et de l'acide urique, haussant le risque de formation de calculs dans les urètres). Lisez aussi : Soda : effets négatifs des sodas sur votre santé.
Rappelons que l'excrétion est l'action par laquelle des substances sécrétées d'un organisme vivant sont expulsées (sous forme de solides, liquides, gaz ou mucus).
2) Certains fruits, légumes et noix
Certains fruits et légumes augmentent l'excrétion urinaire du citrate (qui inhibe les calculs). La consommation d'aliments à haute teneur en oxalate (épinards, rhubarbe, betterave, bette, noix, cacahuètes) devrait toujours être réduite au minimum ou combinée simultanément à des aliments apportant beaucoup de calcium (combiner par exemple les épinards avec un gratin de fromage). Lisez aussi : Alimentation riche en calcium, effets du manque de calcium.
D'autres fruits et légumes à teneur moyenne en oxalate devraient également être évités : les raisins, les framboises, les fraises, la canneberge, la confiture, les gâteaux aux fruits, le gombo, les patates douces, les poivrons verts, le céleri. Evitez également le jus de pamplemousse. Lisez aussi : Quelles couleurs de fruits et légumes santé consommer prioritairement ?.
Combiner de la sorte empêche l'absorption de grandes quantités d'oxalate par l'intestin (ce qui aurait mené à une augmentation de son excrétion dans l'urine, donc du risque de formation des calculs).
3) Viandes, volaille, poissons
Une consommation excessive de protéines à partir de viandes (boeuf, porc), blancs d'oeuf et de poissons accroît le risque de formation de calculs, parce que l'urine est trop acidifiée et l'excrétion de l'oxalate, du calcium et de l'acide urique augmente, tandis que l'excrétion de citrate (qui apporte une protection contre la formation de calculs) diminue. Lisez aussi : Alimentation à haute teneur en protéine.
La consommation de viandes, volailles et poissons doit donc être réduite quand vous souffrez de calculs rénaux. Attention, il ne faut pas arrêter d'en consommer, seulement en manger avec modération. Parlez à votre médecin ou diététicien si vous souhaitez connaître avec certitude la quantité de protéines dont vous avez besoin et la meilleure manière d'en consommer. Lisez aussi : Choses à savoir sur le mercure dans les poissons.
4) Sel
Le sodium contenu dans le sel de table (chlorure de sodium) peut augmenter le risque de formation de calculs, probablement en augmentant l'excrétion de calcium via la voie urinaire (ce qui augmente le risque de formation de calculs). D'un autre côté, une réduction drastique de sel provoque une diminution du volume urinaire (ce qui n'est pas conseillé parce que les calculs minuscules ne peuvent plus passer régulièrement). Lisez aussi les 10 aliments les plus riches en sodium.
Une légère réduction de la consommation de sel (6 g maximum par jour, soit 2 à 3 g de sodium par jour) est donc recommandée, plutôt qu'un arrêt total de consommation. Il est conseillé de manger moins de hot dogs, de charcuteries, de choucroute, de nourritures vendues en conserve, de soupes sèches, de cornichons, ainsi que des plats prêt-à-manger qui contiennent souvent une quantité élevée de sodium. Lisez aussi : Sodium : bienfaits santé, risques et symptômes du manque de sodium.
5) Bonbons
Une consommation excessive d'aliments riches en sucre augmente l'excrétion urinaire de calcium et ainsi potentiellement le risque de calculs rénaux. Probablement plus important encore est le fait que le chocolat, les pralines et d'autres aliments contenant du cacao contiennent beaucoup d'oxalate. Lisez aussi : Cacao : bienfaits santé, le cacao aide-t-il à maigrir ?.
6) D'autres aliments riches en oxalate
Les germes de blé, le son de blé, les crackers au soja, le gruau d'avoine, le foie, les haricots.
7) Les aliments très riches en vitamine C
Veillez à ne pas consommer trop d'aliments à haute teneur en vitamine C (comme les oranges). L'acide ascorbique peut inhiber le pH urinaire (qui réduit le citrate urinaire, un inhibiteur naturel de calculs rénaux). Lisez aussi : Orange : un fruit rempli de bienfaits santé, nutriments des oranges.
> Aliments à consommer plus souvent pour éviter les calculs rénaux (ou les soigner)
1) Eau et autres liquides non alcoolisés
Buvez beaucoup d'eau pour expulser les calculs hors de votre voie urinaire quand elle n'est pas bouchée. Si vous avez des calculs rénaux, il est recommandé de boire entre 2 et 3 litres d'eau chaque jour. Boire 4 litres d'eau est nécessaire dans certains cas (consultez votre médecin pour connaître le volume d'eau précis à boire), surtout si vous faites beaucoup de sport. Lisez aussi : 12 trucs pour boire assez d'eau tous les jours.
Il est important de boire régulièrement sur la durée des 24 heures qui composent une journée. Divisez le volume d'eau à parts égales autant que possible sur les 24 heures. Pensez à boire avant d'aller au lit parce qu'une urine nocturne trop concentrée encourage la cristallisation et la formation de calculs.
Même si l'eau est la meilleure boisson, presque toutes les boissons peuvent convenir. L'eau minérale riche en bicarbonate et en calcium ainsi que des jus de fruits 100% naturels (sans sucre ajouté) sont particulièrement bénéfiques. Evitez simplement le jus de pamplemousse. Vous pouvez boire de la limonade faite à partir de vrais citrons (et non d'arômes de citron). Cette boisson est riche en citrate, qui peut aider à prévenir les calculs rénaux. Lisez aussi : Alimentation riche en eau à adopter.
2) Lait et produits laitiers
Contrairement à ce que vous pourriez le croire (et à ce que les experts pensaient il y a quelques décennies), une restriction en calcium n'est plus recommandée. De grandes études réalisées sur des dizaines de milliers de personnes souffrant de calculs rénaux ont clairement montré qu'avec une consommation de calcium accrue jusqu'à 1 200 mg par jour, le risque de formation de calculs baisse significativement (et n'augmente pas comme les experts le croyaient auparavant).
Une étude co-réalisée par l'hôpital "Brigham and Women" (Boston, Etats-Unis) et l'école de médecine de l'Université de Harvard (Boston, Etats-Unis), sur plus de 90 000 femmes, a montré que les femmes qui consomment beaucoup de calcium ont moins de risque de développer des calculs rénaux que celles qui consomment insuffisamment de calcium. Selon les chercheurs, cela se produit parce que le calcium alimentaire s'attache à l'oxalate, alors il ne peut être absorbé par les reins pour fabriquer des calculs. Lisez aussi : Boire du lait pour perdre du poids ?.
Une consommation de calcium de 1 200 mg par jour au total, sur lesquels 800 mg devraient provenir de produits laitiers est ainsi recommandée pour éviter ou soigner les calculs rénaux.
Evitez de prendre des suppléments de calcium et de vitamine D car ils ne sont pas absorbés facilement par le corps. L'étude de l'Université de Harvard montre que la prise de suppléments de calcium augmente légèrement le risque de lithiase rénale. Les chercheurs supposent que cela se produit parce que les suppléments ne sont pas pris en conjonction des repas, limitant la capacité du calcium à neutraliser l'absorption d'oxalate.
From: http://www.regimesmaigrir.com/actualites/article.php?id=1143
- (479)The various phases of classical music?
Musique des origines
Musique grecque ancienne
Musique de la Rome antique
Musique médiévale
Musique de la Renaissance
Musique baroque
Musique de la période classique
Musique romantique
Musique moderne
Musique contemporaine
- (549)Contropétrie nooobs
Elle compile le C
- (591)What Politeness formula to use (French) in which situation?
http://www.lettresenligne.com/articles/read.php?article_id=6
http://www.abc-lettres.com/formule-politesse.html
- (596)Special numbers for mobile phones
#31# => cache le numéro
#*06# => IMEI
666 => répondeur FreeMobile
- (614)Flowers that I like (in flourishing order?)
- Glycine
- Robiner faux accacia
- Lilas
- Églantiers / Roses
- Jasmin
- Tilleuls
- (631)Places to go with (girl) friends?
concerts jazz rue resto jap (Mr Prince)?
concerts jazz à côté schola cantorum
concerts duc des lombards, etc.
http://www.lebelcanto.com/
- (634)How to learn how to repair a car?
Look for books of the "Haynes" series
- (637)Restaurants in Strassbourg
1- Mon resto bio préféré (vegetarien et poisson):
Une fleur des champs
http://www.restaurant-naturel-et-biologique-67.com/contact.php
C'est dans le centre, à côté de la place Broglie (près de l'opéra)
2- Les bars sympas de Strasbourg
- Bars branché à côté de la place St Etienne:
Mudd Club: http://www.mudd-club.fr/
Le phonographe:http://www.qype.fr/place/1553945-Le-Phonographe-Strasbourg-
- Bar un peu roots/hippie situé dans la Grand Rue (propose des quiches bio, planchettes fromages bio aussi):
L'artichaut: http://www.lartichaut.fr/
- Bar proposant des planchettes fromages:
Jeannette et les cycleux:
http://www.lenetdejeannette.com/
3- Pour boire un verre en terrasse:
Péniches du quai des bâteliers:
Atlantico: http://www.cafe-atlantico.net/
Terrasses de la Place du marché Gayot:
http://www.qype.fr/place/375230-Place-du-Marche-Gayot-Strasbourg-
4- Tartes flambées:
Au brasseur: http://www.aubrasseur.fr/
5- Parcs:
- Ne pas rater le parc de l'orangerie! Et surtout regarder en l'air car les cigognes offrent un spectacle magnifique
- Pour les lacs, il est possible d'accéder au Baggersee par le tram A (puis prévoir après 5/10 min de marche):
http://maps.google.fr/maps?hl=fr&client=firefox-a&hs=gAq&rls=org.mozilla:fr:official&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&biw=1280&bih=605&um=1&ie=UTF-8&q=baggersee&fb=1&gl=fr&hq=baggersee&hnear=0x4796c8495e18b2c1:0x971a483118e7241f,Strasbourg&ei=6AbVT4ubC4LJhAeM0LDPAw&sa=X&oi=local_group&ct=image&ved=0CAYQtgM
6- Pour le vin, il faudrait faire la route des vins (ça vaut vraiment la peine).
Sinon il est toujours possible de faire des dégustations à Strasbourg.
Il y a les hospices de l'hôpital civil qui propose des dégustations avec fromage dans leur cave:
http://www.vins-des-hospices-de-strasbourg.fr/
7- Pour danser:
La Péniche Latino (quai des pêcheurs aussi) propose des soirées salsa le samedi soir:
http://www.barcolatino.fr/
8- Pour les bons plans concert: penser à aller à la boutique culture juste en face de la cathédrale, ils savent tout ce qui se passe à Strasbourg!
From: A.M. Duarte
- (721)Simple Tips&Tricks for home usage - 1
- vis dont la tête est foutue => placer un bout d'elastique plat dessus et utiliser le tourne-vis normalement
- peinture sur la peau => frotter avec un muchoir imbibé d'huile d'olive
- calcaire sur la pomme de douche => mettre du vinaigre blanc dans un zip-bag et l'attacher avec un élastique autour de la pomme. Laisser tremper un moment
- fenêtres sales et pas de produit => utiliser du cola, l'acide citrique va nettoyer
- ouvrir une enveloppe sans déchirer => la mettre au freezer 30 min
- attaques de mouches/moustiques => mettre une "Dryer sheet" dans la poche (lingette nettoyante ? lingette assouplisseur?)
- votre éponge pue ? => mettre un peu de produit vaisselle et eau + passer au micro onde
- Chiottes sont sale => 2/3 pastilles d'alca-setzer
From: http://www.youtube.com/watch?v=AclA-7YntvE
- (722)Simple Tips&Tricks for home usage - 2
- batteries trop petites => combler avec du papier d'alu
- chaussurent puent => mettre dans un zipbag + passer au freezer
- connaitre la quantité de gaz restante dans une bonbonne => verser de l'eau chaude dessus puis passer le doigt de haut en bas. Là où c'est froid c'est la limite (le propane absorbe la chaleur)
- ranger ses affaires optimalement dans un sac de voyage => les rouler
- votre pièce pue ? => verser de l'huile essentielle sur les ampoules
- votre stylo à bille est bloqué => chauffer la pointe au briquet
- le bouchon de votre bocal est impossible à ouvrir => perser la capsule avec un couteau
From : http://www.youtube.com/watch?v=ImTvDDbSZys
- (723)Simple Tips&Tricks for home usage - 3
- pas de tire-bouchon => visser une vis et tirer avec la partie "retire clou" d'un marteau (ou autre)
- Les oignons vous font pleurer => les passer au frigo 50 minutes
- Éviter les débordement de casserole quand l'eau bout => poser une cuiller en bois sur le dessus de la casserole
- Tester la fraîcheur d'un oeuf => il est bon s'il coule dans un verre d'eau
- Besoin d'un entonoir => couper un coin dans un zip-bag
- Faire des beaux glaçons => bouillir l'eau avant
- nettoyer un micro-onde => préparer un bol mi-eau mi-vinaigre blanc et le laisser bouillir qq minutes dedans
- pas de fer à repasser => couvrir le fond d'une casserole avec du papier alu, la faire chauffer sur la plaque, la prendre pas le manche et s'en servir comme d'un fer à repasser ;)
From: http://www.youtube.com/watch?v=VnHLKKQgSMY
- (724)What to when buying an apartment in France?
- Frais d'agence = ~5% ("Frais F.A.I." = Frais d'Agence Inclus dans le prix affiché)
- Frais de notaire = ~7.5%
PREMIÈRE VISITE
- Tout visiter (inclus cave, combles, etc.)
- Se renseigner sur le bruit (écoles, aéroport, etc.)
- Se renseigner sur la présence de nuisibles (fourmis, termites, etc.)
- Se renseigner sur les PLU (constructions de métros, zones inondables, etc.)
COMPROMIS VENTE
- Une fois signé => rétractation possible pendant 7 jours
- Normalement dans les locaux de l'agence
- Se signe en présence de l'agence/vendeurs/acheteurs
VENTE DÉFINITIVE
- Re-visiter le logement juste avant la vente définitive pour :
- Faire un RELEVÉ DES COMPTEURS EDF/GDF/EAU
- RÉCUPÉRER l'ancien numéro de téléphone des vendeurs
- vérifier que rien n'a changé/été cassé, lors du départ des vendeurs
- vérifier que les meubles prétenduement vendus par les vendeurs sont bien là
- Normalement, dans les locaux du notaire du vendeur
- Se signe en présence de l'agence/vendeurs+leur notaire/acheteurs+leur notaire
- En tant qu'acheteur, prévoir au moins 2 chèques pour le remboursement des Charges et de la taxe foncière (ATTENTION: officiellement on ne la rembourse au prorata!) aux vendeurs
- Notaire de l'acheteur collecte les sous de l'acheteur et paie le vendeur le jour de la vente définitive
- Notaire de l'acheteur débloque les fonds du crédit et les reçoit sur un compte à lui réservé
- Notaire de l'acheteur reçoit l'appart personnel de l'acheteur sous la forme d'un chèque de banque le jour de la vente définitive
- PENSER à appeler un assureur pour assurer le logement le jour même de la vente (dégât des eaux, feu, etc.)
APRÈS LA VENTE
- Mettre en place un suivi de courrier de LaPoste
- Faire le changement d'adresse auprès :
- Employeur
- Impôts
- Opérateur Internet : Free/FT/Bouygues?
- Opérateur Téléphonie Fixe/Mobile (FT/Free?)
- Assurances (MAIF/Radiance?)
- EDF/GDF
- Banques (même celle du crédit !)
ASSURANCES
- Elles peuvent être différentes de celles de la banque qui fait le prêt (d'ailleurs, il vaut généralement mieux faire appel à des extérieures car la banque passe des accords avec la sienne et se sert au passage, ce qui fait le coût total final plus cher pour le souscripteur)
PRÊTS
- Si on passe par un courtier (e.g. Meilleur-taux.com) => NE PAS faire de simulation avec sa propre banque, sinon ce dernier ne pourra pas le faire
- Normalement le courtier est gratuit, il se sert sur ce qu'il négocie avec la banque
- Faire retirer du prix les meubles laissés par le vendeur => évite les frais de notaire dessus
- Prêts relais et prêts à taux variable = DANGEREUX
- Demander/Négocier le remboursement anticipé sans frais (bien vérifier que TOUT sera gratuit, même les éventuelles nouvelles simulations)
- Quand la banque envoie la proposition de contrat, il faut respecter un délai de 11 jours MINIMUM pour l'étudier
- Faire attention aux conditions générales vs. spécifiques (ce sont ces dernières qui priment en cas de conflt)
- PTZ+ (Prêt à Taux Zéro) dépend de :
- Qualité énergétique du bien acquis
- Apport Personnel
- Montant du crédit
- ATTENTION: chez Crédit Agricole et Banque Populaire, chaque agence est indépendante => faire crédit dans une agence pratique/proche de chez soi.
- Plus tard, si les taux changent, il est toujours possible de renégocier le taux de son propre prêt avec sa banque, voire de faire racheter son prêt par une autre banque.
- (725)What are the steps of an international delivery?
- Posting
- Outward office of exchange
- Handed over to Air Carrier
- Arrival at inward office of exchange (=customs)
- Departure from inward office of exchange (in the US you won't have to pay fees, but they still inspect packages)
- Arrival at delivery office (your PO)
- Delivery
- (817)How to listen to French radios on the internet?
- Get the playlist of the corresponding radio:
http://www.listenlive.eu/franceinfo.m3u
- Use Mplayer or VLC or Audacious or any player you like :)
- (820)How to remove bicycle grease from your hans?
First wash your hands with a drop of table butter, then wash them normally with soap!!!