configurer son aptitude

Par mc, 14 février 2010 22 h 19 min

voila un moment que je tente d’évangeliser aptitude autour de moi et ca n’est pas la première fois que les bras m’en tombent quand la réponse est: « aptitude c’est nul parceque ca installe et deinstalle plein de trucs » ….

sudo cat /etc/apt/apt.conf.d/99local
Apt::Install-Recommends "false";
Aptitude::Delete-Unused "false";

http://algebraicthunk.net/~dburrows/projects/aptitude/doc/fr/ch02s04s05.html

euler 1 en zsh

Par mc, 30 janvier 2010 18 h 48 min

as we debated about reusability in shell scripting. i wrote a solution for the euler’s project problem 1.

- multiple_of writes a condition string usable by awk.
- sum compute the sum of the stdin entries that matches the condition
- seq is a standard command that generate a list of natural

multiples_of () { print -n '!( $0 % '$^@') || ' 0 }</code>
 
sum () {
awk "$( $@ )"' { i=+$0 }
END { print i }
'
}
 
seq 9 | sum multiples_of 3 5

poste de travail pas cher

Par mc, 29 décembre 2009 15 h 21 min

http://www.materiel.net/ctl/Ecrans_LCD/51261-ProLite_B2409HDS_W1.html

et

http://www.materiel.net/ctl/PC_de_bureau/53199-Slim_N10_blanc_.html#avis

+ clavier et souris usb + clable HDMI.

J’ai ca sur mon bureau en test … je sais pas si je vais le filer a son proprio définitif :)

compiz grid: je peux enfin utiliser gnome

Par mc, 29 décembre 2009 15 h 13 min

Grid est un module de compiz qui permet d’avoir le comportement d’un tilling window manager simple. quand je dis simple c’est:

- 2 clicks pour la config.
- c’est foutrement bien pensé : moins de 1 mn pour le prendre en main et pour trouver que finalement, ils etaient nuls mes mappings sous ion.
- me donne accès 90% des fonctionnalités qui faisaient que j’utilisais des tilling VM (tout en restant en mode flottant)
- ca n’est pas aussi souple qu’avec un tilling comme ion mais ce point est largement compensé a mes yeux par le fait de pouvoir enfin utiliser le meme VM que monsieur tout le monde, sans aucune autre manip a faire que les 2 clicks pour activer le bouzin!

en pratique:

aptitude install compizconfig-settings-manager compiz-fusion-plugins-extra
# sous ubuntu ca marche :) (Stereo, notre correspondant sur mars, a visiblement du mal sous debian)

sous gnome allez dans le menu:

system/preferences/advanced desktop effects settings

puis cherchez « grid » … y’a plus qu’a activer! Au passage: jetons un coup d’oeil sur les mappings pour comprendre le fonctionnement machin:

En gros: ca divise l’écran en 4. vous voulez utiliser le bord superieur gauche de l’écran avec la fenetre courante ? ctrl-alt-1. ctrl-alt-7 pour le bord inferieur gauche. Pour occuper toute la partie gauche de l’ecran ctrl-alt-4!

Dans les 3 cas, vous pouvez élargir la fenetre en répétant la combinaison jusqu’à 3 fois!

Exercice: faites les memes manips avec le bord droit :)

vim: my 2 cents yaml debugger

Par mc, 18 novembre 2009 10 h 55 min

my ~/.vim/ftplugin/yaml.vim

" put yamllint or any yamlparser in your $PATH
" personnaly, i have
" yamllint () { perl -MYAML -e 'print Dump YAML::LoadFile("'"$1"'")' }
" in my .zshenv
" type ,c in normal mode to know if you file is valid
 
nnoremap ,c :!yamllint %<cr>
 
" the common mistakes are 
"
" forget a space after the : at the end of a key
" /:\S
" replace : by ; at the end of a key
" /^[^:]+;\s
" forget the comma when you write [ key, { a: a } ]
" /\v\[^,]+\{
"
" put it all together: 
" now you can type ,E in normal mode to walk through 
" the common mistakes you wrote
 
nnoremap ,E /\v:\S<bar>\[[^,]+\{<bar>^[^:]+;\s<cr>

perl completion in vim: i finally try it

Par mc, 10 novembre 2009 1 h 20 min

I was waiting a long time to have a perl completion system in vim. I waited because i’m lazy and because i thought someone more skilled than me will finally handle that. I don’t know about PPI or other perl parsing technics and i expected the completion to be really smart.

Time passed and there is no such thing in the place. I used ctags completion but it’s very borring to see packages names of your whole @INC when you try to complete a method name.

Still waiting for something really smart, i spent 2 evenings to write a ‘not so smart completion’ … my first use cases surprised me is it seems to be smart enought to go on waiting for another long time :-) .

I’ll try a daily use starting tomorrow and will feedback in a week. If you can’t wait for testing, debugging, feedback:

the perlcfu git repo

use vim as package management tool

Par mc, 23 octobre 2009 18 h 34 min

- i wrote some commands that gives me a list of rpm archives i can install on my system.
- i piped the result to vim –
- now i want to search on the list, install some of those packages and keep track on what i installed.

first: split the screen:

:sp /tmp/installed_rpm

now you get:
- the installed at top
- the candidates at bottom

then write a macro:

:nnoremap ,i dd<c-w>kp:!yum install <c-r><c-a><cr>

now, you just have to put the cursor on a candidate and type ,i to install and keep track. yes it works: i’m using it right now :)

the macro means:

:nnoremap ,i  # when you type ,i in normal mode 
dd            # delete the line
<c-w>k        # jump to the top window
p             # paste the line
:!yum install # begin to write a shell command: yum install
<c-r><c-a>    # append the current line to the command
              # :h c_ctrl-r_ctrl-a for futher information
<cr>          # validate the shell command by typing <cr> [ENTER]

those kind of things is why i don’t ever consider using another editor.

perl onliners, vim and iso2709

Par mc, 12 octobre 2009 12 h 47 min

tips of this post are cool even if you don’t deal with iso2709.

i wrote a post to explain how sweet it can be to use vim to deal with stdout. Now i want to see the content of a iso2709 file.

as the record separator of iso2709 is « \x1d » but vim

- can’t define a separator different from the standard ones ( combining « \r » and « \n » )
- is very bad to manage very long lines (what an iso2709 file actually is for it)

to navigate in your file, it would be cool to append a « \n » just after « \1xe » (field separator) but with no side effect on the original file. Perl do it easily by mixing -E -0 and -n.

-e flag is to execute perl code ( -E to include perl 5.10 features )

perl -E 'say "hello"'

-n make this code executed for each lines of a read file ( $_ : line content, $. : line number )

cat /etc/hosts
# can be written
perl -nEprint /etc/hosts
grep -n localhost /etc/hosts
# can be written
perl -nE '/localhost/ and print "$. : $_"' /etc/hosts

-0 can change the record separator so

perl -0x1e -nEsay biblio.iso2709

read the file field by field ( -0×1xe ) and append a « \n » (say does it) at the end of each one. Pipe it to vi and you’ll have a fast way to walk through your file.

perl -0x1e -nEsay biblio.iso2709  | vim -

also, set dy (display) to uhex to see the hex codes of the separators ( « \x1d » for the record, « \x1e » for field, « \x1f » for subfield)

:set dy=uhex

also note that perl -n accepts some sed style range

# just see the records 10 to 23
perl -0x1d -nE'  10..23 and print' biblio.iso2709  | vim -
# just see from record 10 to the record that contains the word 'plan9'
perl -0x1d -nE'  10../plan9/ and print' biblio.iso2709  | vim -

and the awk style BEGIN and END blocks

# count the number of records
perl -0x1d -nE 'END { say $. }' biblio.iso2709

liens git

Par mc, 5 septembre 2009 9 h 44 min

tappez « apropos git » pour voir la grosse documentation git présente sur votre systeme
( gittutorial gittutorial-2 gitglossary …). il existe une commande git help qui affiche les mans des sous commandes. ainsi, pour avoir la doc de merge, tappez git help merge.

les hooks c’est bien mangez-en.

backupez vos gits avec git-packobjets?

Chris avait posté une astuce pour virer les objets inutiles d’un depot. quelqu’un se souvient ou ?

les guides:

pro git
sourcemage git guide
git magic

hebergements:

heberger soi-même avec gitosis (package debian existant) ou faire un depot publique avec gitorious ou github.

liens git

Par mc, 5 septembre 2009 9 h 42 min

tappez « apropos git » pour voir la grosse documentation git présente sur votre systeme
( gittutorial gittutorial-2 gitglossary …). il existe une commande git help qui affiche les mans des sous commandes. ainsi, pour avoir la doc de merge, tappez git help merge.

les hooks c’est bien mangez-en.

backupez vos gits avec git-packobjets?

Chris avait posté une astuce pour virer les objets inutiles d’un depot. quelqu’un se souvient ou ?

les guides:

pro git
sourcemage git guide
git magic

hebergements:

heberger soi-même avec gitosis (package debian existant) ou faire un depot publique avec gitorious ou github.

Panorama Theme by Themocracy