Skip to main content


Showing posts from March, 2013

iptables unknown option sport

When playing with iptables, you might encouter this message: iptables v1.4.7: unknown option `--sport' Try `iptables -h' or 'iptables --help' for more information. This is because you have used the "--sport" option without having specified which protocol it applies to. You have to tell wether you want to apply this on TCP or UDP. The behaviour of iptables is not to assume you want to apply this to both.

ocaml list directory

Goals The goal with this very simple script is to list a directory and find who is a directory, who is a file. The secondary goal (for me) is to run it as a script. I dont want to compile it but just run it as I would run bash, Perl or PHP script. The code This is how I do it : #!/ usr / bin / ocamlrun / usr / bin / ocaml #load "unix.cma" ;; print_string "Loaded Unix\n" ;; let tmp_dir = Unix .opendir "/tmp" ;; print_string "opened /tmp\n" ;; (* let tmp_dir_files = Unix.readdir tmp_dir;; *) let print_type a_thing = match Sys .is_directory ( "/tmp/" ^ a_thing ) with | true -> print_string ( "Dir:\t" ^ a_thing ^ "/\n" ) | false -> print_string ( "File:\t" ^ a_thing ^ "\n" );; print_type ( Unix .readdir tmp_dir );; print_type ( Unix .readdir tmp_dir );; print_type ( Unix .readdir tmp_dir );; print_type ( Unix .readdir tm

instal tomcat6 on centos6 using yum

Install Tomcat After some experimentation, I found that I had to issue this install command to get a begining working Tomcat: sudo yum install tomcat6.noarch tomcat6-webapps.noarch tomcat6-servlet-2.5-api.noarch tomcat6-jsp-2.1-api.noarch tomcat6-admin-webapps.noarch tomcat-native Dependencies Just be carefull that this will bring a lot of dependencies: ==================================================================================================================================== Package Arch Version Repository Size ==================================================================================================================================== Installing: tomcat-native x86_64 1.1.24-1.el6 epel 56 k tomcat6 noarch 6.0.24-45.el6

lookup reverse ip

Reverse IP Reverse lookup is needed for several uses. To check what is the reverse of an IP address, one can issue: dig -t PTR +short Easily reverse an IP Using "awk", reversing an IP address can be done with $ echo "" | awk -F "." '{for (i=NF;i>=1;i--) printf $i"."; print ""}' Or putting this in a simple SHELL script (i.e ""): #!/bin/bash echo $1 | awk -F "." '{for (i=NF;i>=1;i--) printf $i"."; print ""}' and calling it: $ ./ Used in one line with "dig": $ dig -t PTR +short $(

no switchport mode dynamic desirable

mode access to mode trunk I got a Cisco 2950 swicth where a port is configured "access vlan 54". I want to make vlan 54 native on this and put a vlan 150 over it. I then have to enter something like: interface FastEthernet0/4 description vers switch admin1 fa0/17 switchport trunk encapsulation dot1q switchport trunk native vlan 54 switchport trunk allowed vlan 54,150 no cdp enable Unfortunately, when runnnig the configuration, I get: interface FastEthernet0/4 description vers switch admin1 fa0/17 switchport trunk encapsulation dot1q switchport trunk native vlan 54 switchport trunk allowed vlan 54,150 switchport mode dynamic desirable no cdp enable Whatever I tried, I always got the "switchport mode dynamic desirable"... no, then mode trunk The solution was to negate the dynamic and directly force trunk. I entered the configuration in this order: interface FastEthernet0/4 no switchport mode dynamic desirable switchport mode trunk switchport t

ezpublish add siteaccess

Goal I first wanted to install ezteamroom on my ezpublish 4.3, but it requires me to have created "siteaccess" before. This is how to create "siteaccesses" Documentation There is an existing documentation , but guess why screenshots did not match my installation. Download requirements I had to install ezwebin, and as I am there, I also installed all the ezteamroom requirements: git clone ezwebin git clone ezlightbox git clone ezxmlinstaller git clone ezteamroom git clone ezevent Then following the documentation is OK, but you just dont need to swap the "Home" page because the root node is already a folder. What's next Let's install ezteamroom, then...

tarifs 4G blueline

Offre Blueline à Madagascar Pour ceux qui se posent la question, à ce jour (voir date de ce message) voici les prix de l'offre 4G de blueline. On a 2 options: louer ou acheter l'équipement (le modem). Les offres sont plus chères en location type mise en service frais mensuels 40h/mois à 512Kbps 99000 99000 "illimité" à 512Kbps 99000 149000 "illimité" à 1Mbps 99000 249000 "illimité" à 2Mbps 0 390000 "illimité" à 4Mbps 0 690000 C'est juste un résumé, moi ce n'est que Internet qui m'interesse, mais dans les offres il y a une carte SIM "Blueline" et un pack de chaines TV différent selon les offres prises. Les prix sont en MGA, TTC. Il y a engagements sur 24 mois.

KVM Ubuntu

Installer KVM # aptitude install kvm libvirt-bin virt-manager virt-viewer python-libvirt python-virtinst bridge-utils Mettre l'utilisateur courant dans le bon groupe: # adduser `id -un` libvirtd Configurer le réseau de la machine hôte: auto eth0 iface eth0 inet manual auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address netmask gateway bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0 Lancer l'installation d'une machine: virt-install --connect qemu:///system \ -n debian-testing-i386-003 \ -r 1024 \ -f /data/vm-hd/debian-i386-003.qcow2 \ -s 12 \ -c /data/vm-isos/debian-testing-i386-netinst.iso \ -k fr \ --accelerate \ --noautoconsole \ --network=bridge:br0

arandr quick fix invalid literal for int with base 10

Very dirty fix If you ever get this, be aware that it's a known bug, and it's because of the "i" in: [mihamina@dell-f17 ~]$ xrandr -q Screen 0: minimum 320 x 200, current 2390 x 768, maximum 8192 x 8192 LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm 1366x768 60.1*+ 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 VGA1 connected 1024x768+1366+0 (normal left inverted right x axis y axis) 0mm x 0mm 800x600 60.3 + 85.1 72.2 75.0 56.2 1280x1024 60.0 1280x960 60.0 1280x800 74.9 59.8 1152x864 75.0 70.0 1280x768 74.9 59.9 1024x768 85.0* 75.1 70.1 60.0 1024x768i 43.5 <========== THERE!! 1024x576 60.0 848x480 60.0 640x480 85.0 72.8 75.0 60.0 720x400 85.0 70.1 640x40

kvm ksm tuning

Context I am running a no-brand machine,  CentOS 6.3 2 cores 8GB RAM 1 SATA disk On this I fired 6 virtual machines 2 Centos 6, 1GB RAM each 4 Windows XP, 2GB RAM each The reader probably noticed I overbooked RAM: If all the VM will use the available RAM it will fill up to 10GB. I wanted to test the KSM effect on this. The default KSM settings on this OS is: KSM_MONITOR_INTERVAL=60 KSM_SLEEP_MSEC=100 KSM_NPAGES_MAX=1500 The result I got is: Memory usage fits in RAM (very low swap usage Too high CPU usage for scanning "same pages" (constantly using the equivalent of 70% of 1 core) Disk IO is reasonnable, but on the other hand load average is high (10) The Windows XP VM are desperately slow (not a surprise) Tuning Before tuning, I collected what ressource I could use more This machine can bear more disk IO: I can use swap and RAM a bit more This weak CPU should be a bit more used by VMs instead of KSM My fisrt idea is to make KSM check less often.

upgraded to fedora 17

I just switched to fedora 17 and noticed no major problems. Note that my upgrade method is about to make a clean install and then upgrade then restore several configuration one by one. The typical example is on Firefox and Thunderbird where the "cache" space is 2GB for the latter. Noticeable facts are that boot time is faster (comfortable on a laptop I use to completely shutdown ratehr than going in sleep or suspend state), and EMacs 24! I espacially thank all the community around Fedora so that I have a great bunch of software to work with.

sas 02 et HTTP

HTTP avant tout Avant de se lancer dans le développement web, il est absolument necessaire de se familiariser avec HTTP. HTTP dans le sas de formation 02 J'ai donc demandé aux stagiaires du sas de formation 02 de s'auto documenter sur HTTP. Comment se sont passé les recherches sur HTTP? Quels mots clés ont apporté quelles réponses? A-t-il été facile de trouver l'information?

ocsigen css and javascript in head

Goal I would like to have this: < head > < title >a sample title< /title > < link href="style.css" type="text/css" rel="stylesheet" / > < script type="text/javascript" src="script.js">< / script > < / head > This would load one "style.css" file and one "script.js" from the HEAD tag. Recipe Static directory in configuration There must be a "static" directory from where we load the static files. In the "ocsigen.conf" file: < host > < site path="xxxx" > < static dir="/home/mihamina/public_html/static/" /> < eliom module="/xxx/xxx.cmo" /> < / site > < / host > The (Da Mihamina) code :-) open Lwt open XHTML.M open Eliom_services open Eliom_parameters open Eliom_sessions open Eliom_predefmod.Xhtml let main_handler sp () () =

difference entre logging et debugging

Debugging On "Debug" quand on souhaite maîtriser l'execution d'un script "fautif", en ayant un maximum d'information possible, comme: L'introspection de variable La possibilité d'introduire des breakpoints et de s'en servir Voir la call stack ... Dans les faits, Firebug a ces fonctionnalités, mais pour Javascript à la base. Rajouter FirePHP lui permet de se rapprocher du debuggage, mais ça n'en est pas. Logging FirePHP est un outil de Logging: Il permet de faire afficher des informations potentiellement utiles. Effectivement, on a l'introscpetion de variable et la visualisation de call stack, mais pas le contôle d'execution.

Comparison of OCaml and other languages

Rosetta and PLEAC When discovering OCaml and trying to introduce it to the people surrounding me, there is always a kind of contest about "who has the shortest". That lead me to find how to resolve common real-life and academic "problems" with my friend's preferred language and compare it with the OCaml solution. I found 2 ressources on the web about that: Rosetta Code 1 and Rosetta Code 2 PLEAC I am looking at more ressources like these ones, if you have some in your bookmarks, because I am going to teach and the new task I'm facing requires some comparisons.

j'ai suivi la formation drupal de drupalfrance

Intervenants Le formateur était Romain Jarraud . Nous étions 10 "élèves", composés de compétances diverses (graphistes, développeurs PHP,...) Salle de formation La salle de formation était une des salles de Media Site , qui sont des salles de grande qualité. La connectivité WiFi est cependant décevante. La formation proprement dite La formation a duré 3 jours. Avec pour thème "développeur Drupal". Il est clair pour chacun qu'en 3 jours il est impossible de faire de quelqu'un un développeur Drupal complet, mais Romain a fait ce qu'il a pu. Jour 1 Nous nous sommes attelé à l'installation d'une distribution Drupal que Romain a préparé pour nous. Nous avons installé des modules "contrib" utiles à la formation. Une mise au point: développer autour de Drupal c'est faire un ou des modules. Nous sommes partis dans la création de  notre module de base, qui pour l'occasion ne faisait pas grand chose à part se faire afficher da

ocaml pipe to a command

Context As Linux system administrator I sometimes need to use pipes. A simple example: $ echo "some content text" | mail -s "this is" I wondered how to do it with OCaml. Pipe with Ocaml What should be done: Open the command as an output channel Send what you want to that channel How to: let buf = Unix.open_process_out "mail -s ddd";; Pervasives.output_string buf "eeeeeeeeehol";; Pervasives.flush buf;; Unix.close_process_out buf;; And you're done!

sas 03 et HTML

Un professionel du web doit passer par la maîtrise de HTML et de CSS. Aussi bien pour obtenir un document HTML à partir d'un fichier Photoshop ou Gimp que pour ne pas défigurer une maquette HTML parceque les données à présenter dynamiquement ne sont pas uniformes, savoir maintenir le design d'un page HTML est important. Le sas de formation n° 03 est actuellement en approfondissement du HTML et des CSS. Que peut-on dire sur ce chapitre dit de "l'intégration HTML"? Qu'avez-vous appris ou découvert? Quelles certitudes sur le métier aviez-vous et sont remises en cause au fil de l'approfondissement?

sas 03 et Firebug, Javascript et DOM

L'étape de formation suivante porte sur Javascript. Par le (lointain) passé programmer en Javascript était une galère relative, surtout à cause de l'absence de debugger digne de ce nom. Actuellement, nous disposons de Firebug et ses nombreuses fonctionnalités Sa console avec séparation des niveaux (info, debug, warning) Ses breakpoints La manipulation du DOM avec Javascript est maintenant supportée par la plupart des navigateur, on peut obtenir des interfaces riches très interessantes avec Javascript. Aujourd'hui, Qu'avez-vous appris sur Javacript? Qu'avez-vous appris sur l'usage de Firebug dans le cadre de votre mini-projet?

vmdk to kvm

Context I have then to transfer the VMWare image to a temporary KVM host. We are on the path to move from RHEL to CentOS. And no, I'm not interested in OL . The current infrasctructure uses "one-file fixed 50GB image disk". Duh!. I want to move this temporarily to KVM, in order to reinstall hosts without braking the developpers work rythm. Documentation I found 2 usefull links for the migration . Tutorial Copy/pasting from the links above did not work, though. This is how I made it: sudo virt-install --import \ --disk path=/var/vmware/dev53/DEV53-flat.vmdk \ -n old-dev53 -r 1024

xdebug selinux

If you intend to use Xdebug, remember to make SELinux doesnt block Xdebug connections to the debugging client. I usually disable SELinux on my development server. This problem is stated on the Netbeans Wiki .

ocaml imap

I am still lookig for an IMAP module for OCaml. during my searches I saw how the POP module is implemented in OCamlNet and I think I could go from this to implement IMAP on OCamlnet Given the small knowledges I have, some help will always be welcomed, if any...

delete email user

Deleting an "email user" After adding a user , I sometimes need to delete it. Using a shell script This is how I delete it #!/bin/bash EMAIL=$1 PASS=$2 EXIM_VIRT_DIR="/etc/exim4/virtual/" DOMAINE=$(echo ${EMAIL} | awk -F"@" '{print $2}') LOCALPART=$(echo ${EMAIL} | awk -F"@" '{print $1}') U=$(echo ${EMAIL} | sed 's/\./-/g' | sed 's/@/-/g') CRYPT1_PASS=$(mkpasswd ${PASS}) echo ${EMAIL} echo ${PASS} echo ${DOMAINE} echo ${LOCALPART} echo ${CRYPT1_PASS} echo ${U} userdel ${U} grep -v "${LOCALPART}:" ${EXIM_VIRT_DIR}${DOMAINE} > /tmp/${DOMAINE} cp /tmp/${DOMAINE} ${EXIM_VIRT_DIR} invoke-rc.d exim4 restart

twig inherit content in blocks

With Symfony & Twig, when you inherit a block you cannot put some texts outside the defined block. Let the "base.html.twig" (the one default in Symfony: <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>{% block title %}Welcome!{% endblock %}</title> {% block stylesheets %}{% endblock %} <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" /> </head> <body> {% block body %}{% endblock %} {% block javascripts %}{% endblock %} </body> </html> When you inherit this template, you can just fill the blocks sections. This will work: {% extends "::base.html.twig" %} {% block body %} Hello {{ name }}! {% endblock %} This wont work: {% extends "::base.html.twig" %} Extra text throwing error. {% block body %} Hello {{ name }}! {% endblock %}

shell random string

Goal Generate a random string picked from a pattern Recipe Build the pattern, the random letter will be taken from it. export ALPHABET="azertyuiopqsdfghjklmwxcvbn"; The length of the string mihamina@pbmiha:~$ echo ${#ALPHABET} 26 Generate a random RANK to pick RANK=$(($RANDOM % ${#ALPHABET})) Pick one random letter fro the pattern RANK=$(($RANDOM % ${#ALPHABET})); echo ${ALPHABET:$RANK:1} Build a 20 characters long random string from the pattern RANDSTRING=""; for I in $(seq 1 20) do RANK=$(($RANDOM % ${#ALPHABET})); RANDSTRING=${ALPHABET:$RANK:1}${RANDSTRING}; done; echo $RANDSTRING Make a function to summarize it function random_string () { ALPHABET="azertyuiopqsdfghjklmwxcvbn"; RANDSTRING=""; for I in $(seq 1 $1) do RANK=$(($RANDOM % ${#ALPHABET})); RANDSTRING=${ALPHABET:$RANK:1}${RANDSTRING}; done; } random_string 3 ; echo $RANDSTRING random_string 5 ; echo $RANDSTRING random_st

facebook mistake disable account

Context On my Android telephone, this afternoon, I tried to use my Facebook account to spend time... Acces denied. I used the FAcebook application from the market. Again, I tried: failure... Damn! I try via the Android web browser, and when I log in, they say something like: "Please use the desktop version of this website because your account has been disabled. After that you'll be able to use Facebook normally". Preceding facts Deveral months, my Facebook account has been "hacked" because of a weak password. But there is no relation with the current events. Several hours before that, I remember I seriously hurted the nuts of a poor young "teeny-hacker" on a Malagasy computing related group, and I knew there would be several actions from him and his friends. That's the way they are. Guess What I think that happened was the guys tried to bruteforce my account on Facebook. As they know I use my email address to log in. Facebook identified it

mon nouveau samsung galaxy s II

Content... "Fan" de Linux, et heureux propriétaire d'un Galaxy S GT-i9000, j'ai acquis un Samsung Galaxy S II. De ce que je sais, les Américain n'ont pu aussi en acheter que ce mois-ci . J'ai certainement tort, peu importe, il est là... avec moi. Et je suis content. Mon Samsung Galaxy S II Je ne suis pas spécialiste de la marque ni des détails, J'ai un Samsung Galaxy S II, GT-i9100. D'origine sous Android 2.3.3, Mais que je compte flasher rapidement en 2.3.5. Mon impression Je compare le nouveau S II à mon ancien S I. Ecran L'écran semble à priori plus "jaune" que celui de précédent. C'est juste un a priori, c'est en fait la gestion de la luminosité en fonction de la lumière ambiante qui est différente. La différence de taille par rapport à l'ancien n'est pas très sensible lors des pointages de boutons et de liens. Par contre, on sens un que finalement les boutons sont un peu plus grands sur le clavier virtuel. C'

my ocsigen project template

Context I often try to develop micro projects with Ocsigen. They are Quick and Dirty things without coplexity, just needing an admin login and deveral things. I mostly start with this Project Template, and clean it the step after. My Ocsigen Project template Its composed by: A main file: An utility file: A Makefile Some tuning to the Ocsigen cofiguration file Some Debian/Ubuntu packages installed The main File open Lwt open XHTML.M open Eliom_services open Eliom_parameters open Eliom_sessions open Eliom_predefmod.Xhtml open Gs module Ep=Eliom_parameters;; let session_table = Eliom_sessions.create_volatile_table ();; let root_service = Eliom_services.new_service ~path:[""] ~get_params:Eliom_parameters.unit () ;; let root_service_with_post = Eliom_services.new_post_service ~fallback:root_service ~post_params:((Ep.string "login")**(Ep.string "password")) () ;; let logout_service = Eliom_serv

Gandi, Dotclear, bloGTK

Bien, C'est depuis un client XML-RPC que j'écris ce post: BloGTK. j'utilise le système de "blog" proposé "gratuitement" par mon hébergeur (de nom de domaine): dotclear. J'ai passé ma période de petit geek qui aime avoir un serveur dédié rien que pour mettre son site personnel. Comme je n'aime pas du tout Facebook, je préfère un blog, quand meme presque 10 ans apres leurs apparition.. Je vais tenter de récuperer le code de mes anciens tutoriaux et les coller ici. En attendant, c'est aprti pour une journée de travail passionnant

compiler ocaml ocamlc ocamlfind

Pour compiler du code Ocaml, on peut utiliser ocamlc ou ocamlfind. Ocamlfind trouvera pour nous les bonnes inclusions et les bons flags qu'il faut. Cependant, comme j'aime bien rester générique, j'utilise l'option verbose de ocamlc pour faire affichier l'invocation entiere. Ceci me permet de rester avec mon ocamlc favori: ocamlfind ocamlc -verbose -package str,netcgi2,netcgi_apache,postgresql,mysql -linkpkg -o params.cgi Donne ocamlc -verbose -o params.cgi \ -I /usr/lib/ocaml/3.10.2/pcre -ccopt -I/usr/lib/ocaml/3.10.2/pcre \ -I /usr/lib/ocaml/3.10.2/netsys -ccopt -I/usr/lib/ocaml/3.10.2/netsys \ -I /usr/lib/ocaml/3.10.2/netstring -ccopt -I/usr/lib/ocaml/3.10.2/netstring \ -I /usr/lib/ocaml/3.10.2/netcgi2 -ccopt -I/usr/lib/ocaml/3.10.2/netcgi2 \ -I /usr/lib/ocaml/3.10.2/netcgi_apache -ccopt -I/usr/lib/ocaml/3.10.2/netcgi_apache \ -ccopt -L/usr/lib/ocaml/3.10.2/pcre \ -ccopt -L/usr/lib/ocaml/3.10.2/netsys \ -ccopt -L/usr/lib/ocaml/3.1

sas 03 et HTTP

Les bases Avec le sas 03, nous venons de commencer une nouvelle session de formation. Puisque nous faisons du développement Web, nous avons commencé par les bases: HTTP. Qu'est-ce que vous avez appris sur HTTP? Que pensez-vous connaître en arrivant dans le sas que finalement vous ne maîtrisiez pas tant que ça? Que vous a apporté les discussions sur HTTP que vous avez eu avec le formateur?

headers check for mailing list and autoreply

Autoresponder and mailing lists I am subscribed to much mailing lists, and espacially on holidays, I notice many people set their autoresponders to reply to the mailing list. It's annoying and whenever possible should be avoided, by checking several headers befor autoreplying. Headers to check and patterns Mailing lists have pretty verbose footprints. Unfortunately, There is no standard I know about that, but there is a simple enumeration of what headers and patterns a mailing list has. Return-Path: and Sender: Return-Path: and Sender: match owner\-\.+@ , ^\.+\-request@ , and ^\.+\--bounces@ List-ID: or X-Mailing-List: If there is a List-ID: or X-Mailing-List: header, it's probably from a mailing list! To: or Cc: If you receive an email, but you're not in the To: or Cc: , then you probably should avoid autoreplying. "Precedence: Bulk" or "Precedence: List" A little documentation about the "Precedence:" header where we see that &

Mihamina Rakotomandimby on Internet

Profiles Google+ (Google Plus) profile LinkedIn profile Viadeo profile Stack Overflow profile LaunchPad profile bookmarks: flow Twitter flow!/rktmb Code repository Google Code SVN repository , for some example and demonstration pieces of code More... Perform a Google Search on "Mihamina Rakotomandimby" Perform a Yahoo search on "Mihamina Rakoromandimby"

CV, Contact Mihamina Rakotomandimby

Personnals Name : Rakotomandimby Mihamina Origin : Madagascar Current location : Madagascar Background : Mathematics, Computer Science Summary IT Engineering team lead Project manager Open source software developper Linux distribution packager Linux system & network administrator  eXtreme programmer,  Functional and Technical documentation writer.  Framework user: Jelix, OCsigen, Django, Zope Languages C,  OCaml,  Python,  Perl,  Javascript,  PHP Mastered softwares by category UNIX System Administrator and Architect: Virtualization: KVM , LXC and OpenVZ Storage: NFS, RAID, LVM, AOE Mail Server: Postfix, Exim, Courier POP/IMAP, Dovecot FreeRADIUS Accounting Database: PostGreSQL, MySQL Directory: OpenLDAP Research & Development: Python: Web and System PHP: Web OCaml: Web and System Perl: System SHELL Scripts: System Experience Training, Recruitement and Development Manager at Ideo Neov August 2011 - Currently : Manage