February 2012
1 post
cisco mac to unix mac with Vim
suppose you have cisco MAC addresses like that :
0011.432A.E9EB 000D.5684.8F8A 000B.DB73.5681 000B.DB73.535C 000D.567E.D2A5 000D.567E.F8A6 000B.DB73.5490 000D.567E.C7B8 000D.567F.304A 0011.432A.F0A5 000F.1FE6.D90F 000B.DB73.49FA 000D.567F.30AD 000D.567E.D173 000D.567F.2E5B
and would like to convert it :
:%s/\.//g...
January 2012
1 post
claws-mail reply model
tired of Mozilla Thunderbird, I’m testing (more deeply this time) claws-mail.
One funny feature is the Model writing script (see settings). Here follows my reply-model script :
%cursor %account_sig (i) en réponse au message de %fullname (%email), (i) du %date_fmt{%d/%m/%Y} à %date_fmt{%H:%M}, ?s{intitulé "%subject", } !s{sans sujet (!)} (i) adressé à : %to ?c{(i) en copie à :...
June 2011
2 posts
5 tags
[find] using -regextype
I don’t know about you.
But for me it’s a pain to escape special chars like that :
[survietamine@desktop omsa-live]$ find -iregex '.*\(contact\|dset\).*' ./DSET_Report_for_Centrapel[localhost.localdomain-SvcTag-16H3F4J-PER710].zip ./data/tmpreport/dsetinfo.xml ./data/xml/oma/docs/dset.css ./data/linux/dsetmemory ./data/linux/dsetboot ./data/linux/xml/dsetboot.xml...
8 tags
[imageMagick] easy resize of images with ratio...
ImageMagick is a real swiss knife for people that want to manipulate pictures. In this post, I’ll only give an easy way to resize an image and keep its proportions. Suppose you have an nice wallpaper (eg, downloaded from Vlad Studio site) on your “full HD” (ok, now i’m supposed to say “hd 1080p”…), and your girlfriend wants it on her laptop which...
December 2010
4 posts
9 tags
chmod +X
For those that already know well how to change permissions, this memo won’t be usefull. Maybe, it can be usefull to some others.
umask is generally fixed to 022. This mask will be applied every times you create files and directories. For directories, umask will be combinated with max permissions 0777 : 0777 - 022 = 755 (rwxr-xr-x) For files, umask will be combinated with 0666 :...
7 tags
[proxy] SSL interception using squid
In this article, I’ll show you how to configure Squid to act like an ‘man-in-the-middle’ with HTTPS connections. If you’re not doing that for yourself (eg : your company/association, you MUST tell people about that, it is ILLEGAL). credits : to achieve this, I mainly have read this documentation (but I did not yet implement dynamic certificates generation) :...
8 tags
web coding basics : REST
I see so much dirty apps and ERP with their own ways to write/exchange data ; so if I can advice coders to re-read this article about REST regularly before writing their crappy codes [hope… ]
http://tomayko.com/writings/rest-to-my-wife
Several translations are available, below the-one for French people : http://www.pompage.net/pompe/comment-j-ai-explique-rest-a-ma-femme/
10 tags
hard disk data recovery
Recently, I had to recover data on a defective hard drive.
Informations on this page helped me : https://help.ubuntu.com/community/DataRecovery
So, this is a memo (in case the source page disappear) :
if your partition table is broken, try to fix it with tools like : testdisk, ntfsfix (ntfsprogs package)
install ddrescue (on Debian based) : apt-get install gddrescue...
August 2010
2 posts
3 tags
[ssh] remove hash for an host
When connecting to a new host, the corresponding RSA fingerprint is showing up and you are prompted to add it
This hash is checked every time you connect to the host. If this hash has changed (OS reinstall, servers upgrade/switching…), a warning is displayed and you are not able to connect to the host.
OK, you can delete the line by editing ~/.ssh/known_hosts file. But the proper way is...
2 tags
[archlinux] VirtualBox post-installation steps
This is printed after installation of virtualbox-sun package. So, if you prefer virtualbox-ose (Open Source Edition) since Sun is now a part of Oracle, check these points :
»> NOTE: »> - Run “sudo /etc/rc.d/vboxdrv setup”, every time your kernel is upgraded, »> to compile virtualbox driver modules for a new kernel version. »> - Add your users...
June 2010
2 posts
7 tags
clonezilla-live config
unlike Microsoft Windows, unix-like systems installation like BSD or GNU/Linux need only a few GB
usb sticks with 8 GB and more are now really cheap
yes, clonezilla is fine
yes, clonezilla server version is very fine
but sometimes, it’s pretty fine too to be able to backup and restore system disks/partitions images from only 1 usb stick.
so let’s go
As I spent some time on...
6 tags
[archlinux] apt-file equivalent
pacman and yaourt are great but… …
Q: Is there an equivalent to apt-file (GNU/Debian) that allows to search for a file within packages not installed (on repositories) ?
A: pacfile
eg : pacfile mkfs.vfat extra/dosfstools-3.0.9-1 sbin/mkfs.vfat extra/dosfstools-3.0.9-1 usr/share/man/man8/mkfs.vfat.8.gz
April 2010
2 posts
5 tags
parallel ssh
pssh and consors are usefull if you administrate a huge number of *nix boxes.
But adding hundred of fingerprints on your ~/.ssh/known_hosts file may take some time.
On a trusted network, here how to bypass this, by using SSH option :
add SSH option (-O) “StrictHostKeyCheckin=no” to the pssh, pscp, pslurp… command
e.g : pssh -P -h machines.list...
3 tags
transparent xlock
@work, when i leave my desk, i have to lock the screen because of open spaces conditions.
But, one of my monitors displays is used for servers monitoring purpose. To enable my coworker to watch it i don’t want animation when screen is locked.
This does work with the xlockmore package :
xlock -mode blank -geometry 1x1
November 2009
3 posts
5 tags
[wii] wbfs management
Xmas and a lot of gifts “duty” are coming…
My son wish for Xmas is a Wii.
As I prefer him not to switch Optical media, i browse the web for infos about the scene.
Yes, even if the DVD media backups copies can work with some loaders, I prefer to prevent alteration, then reburn (slow burning is required for Wii, I use 1x speed)… And avoiding optical medias will save :...
3 tags
about history command
history is a usefull command for many purposes like “recall a command”, investigation…
This memo is about ‘history tips’ i find useful :
add date and time : export HISTTIMEFORMAT=”%F %T “ (or any strftime format, I prefer : %Y%m%d %F)
hide some commands, this may be usefull if you wanna type passwords (like FTP, mysql…) : ...
4 tags
ettercap mitm gateway attack
Long time i didn’t sniff with ettercap, so i typed here an example command :
ettercap -T -m myVictim.log -M arp:remote /172.20.1.1/ /172.20.1.10/
# -T switch tells ettercap to use Text user interface # -m selects and simple log file (output in the gui interface, not the ECI version) # -M selects Man-in-the-middle attack # arp:remote are option for MITM method # 172.20.1.10 is the...
September 2009
4 posts
6 tags
samba's lines to fstab
There was a long time ago I didn’t configure Windows shares access under my linux boxes.
So, I typed here this memo about changes :
‘smbfs’ filetype is deprecated, replaced by ‘cifs’
‘fmask’ is deprecated, replaced by ‘file_mode’
‘dmask’ is deprecated, replaced by ‘dir_mode’
My new (and functionnal) entry to...
5 tags
[bash] is this directory empty ?
here a simply way to test if a directory is empty :
$ [ "$(ls -A /path/to/directory)" ] && echo "Not Empty" || echo "Empty"
and here, a way to find empty directories from a location :
find /path/to/parent/directory -type d -empty
tips found from this source : http://www.cyberciti.biz/faq/linux-unix-shell-check-if-directory-empty/
6 tags
xrandr helps to configure multiple monitors
today, i’ve installed my brand new 21.5” Full HD screen.
The Intel Driver for my i915GM (DELL LATITUDE D610) is unable to set resolution higher than 1400x1050. That’s too bad for my eyes because it is not the native resolution for this screen.
Under GNU/Linux ArchLinux, it was easy to manage :
Detecting screens with :
survietamine@midlap:~$ xrandr Screen 0: minimum...
9 tags
only 1 buffer for X clipboard
pacman -Si autocutsel :
Dépôt : community Nom : autocutsel Version : 0.9.0-2 URL : http://lepton.fr/tools/autocutsel Description : synchronizes the two copy/paste buffers mainly used by X application
update your ~/.xinitrc with these lines :
Autocutsel() { if [ -x...
August 2009
1 post
6 tags
[bash] renaming files with their last modification...
-r switch of date command is useful to achieve this : for i in *.avi; do mv $i “$(date -r $i ‘+%Y%m%d_%H%M%S’).avi”; done
July 2009
1 post
4 tags
removing multiple CR with vim
i’m using mutt email client, and my default editor is vim.
So, when i reply messages providing from crap clients like Outlook with default config that send messages in HTML, the body of my message looks like this :
on Mon, July the 9th, 9:49PM, Mister NO BRAIN wrote :
> hello, > > > blablah…
so, i use the power of vim to delete those multiples “>...
April 2009
2 posts
7 tags
get IP address using sed
It is possible to accomplish this task several ways. Maybe, you know a faster/better way to do that, in that case, I would appreciate if you email-me your solution ! Here are 2 ways with sed, replace/adapt to fit your needs :
imitating ‘cut’ and ‘grep’ with one sed thread : ifconfig eth0 | sed -n ‘s/\(^ *inet...
11 tags
multi-volumes archive under GNU/Linux
I have an external multimedia hard drive from MemUp which is not a great product. The sad thing is that the included media-player feature (when connected to the TV) requires FAT32 partition. This filesystem format from old Microsoft OS doesn’t allow to store files bigger than 4 GB. Since I also use this drive to store backup likes CD/DVD images, I need to split these files.
The...
March 2009
2 posts
7 tags
FLAC to OGG conversion using sox
My audio player (Samsung YP-T10) cannot handle lossless audio formats. The hint is to reach the best quality available on this device because i use quality earphones from Shure. So, this is my bash commandline to convert all FLAC files from a directory to Ogg Vorbis 320kbps (quality=6), it relies on the audio swiss army knife called sox :
...
6 tags
renaming my JPEG photos with the shell tool :...
$ sudo aptitude install jhead
$ jhead -n%Y%m%d_%H%M%S *.JPG
IMG_0170.JPG —> 20090212_210852.jpg … IMG_0198.JPG —> 20090227_195830.jpg
February 2009
1 post
5 tags
about WYSIWYG text editors power
user : Hey, how to add comma to each end of line to this list please ?
survietamine : sed “s/$/,/g” list.txt
user : great, where can i type it on M$ Word ?