logo
03/03/2010

Panels hardware pour simulation avec X-Plane

Je me sers surtout de ce billet comme d'un petit bloc note.

Etant particulièrement fan de X-Plane et venant tout juste d'acheter la version complète (6DVD/70G) pour 29$ (oui oui, vingt neufs dollars) je voulais un peut plus de trucs hardware pour y utiliser :)

Avec, bien sûr une contrainte : que ça fonctionne sous Mac OSX (X-Plane est compatible Linux mais ça ne m'intéresse pas.).

Voilà donc une petite liste des choses sympathiques, et pas trop cher, tournant normalement sous Mac OSX :) :

  • yoke $119 http://www.digitaledgepc.com/yoke.htm
  • pédales $115 http://www.digitaledgepc.com/pro_pedals.htm
  • throttle $109 http://www.digitaledgepc.com/pro_throttle.htm
  • boutons, radio, engines etc. voir :
    • http://www.xpluginsdk.org/goflight.htm ici pour la compatibilité avec le plugin X-Plane
    • http://www.simw.com/index.cfm?fuseaction=dspproductslist&mid=2&smid=118 ici (compter 100€ à 250€ par module) pour l'achat des modules GoFlight
  • magnétos lights & gears : http://www.xpluginsdk.org/saitek.htm
    • Le Flight Switch Panel coûte ~99€ soit moins cher qu'un module GoFlight.
  • Le DIY :) :
    • Pour X-Plane il faut des cartes 'spécifiques' (tout est expliqué sur le site).
    • Les cartes sont donc les #2120 #2160 et #1065 qui devraient toutes fonctionner sous X-Plane.
    • Ici (entre 50$ et 100$, des 18F2550 a 17$ préprogrammées sont disponibles pour ceux qui veulent se faire une board custom (schematics sur le site)) : http://www.desktopaviator.com/ et http://www.desktopaviator.com/Products/parts.htm

Personnellement dans un premier temps ça sera une #2120 et #2160 ainsi que quelques switchs, montés sur le début d'un panel en bois custom, et après selon l'envie probablement des modules GoFlight et éviter le saitek (ça réduit le nombre de plugins :)) et entre temps yoke/pédales et throttle :)

20/02/2010

Custom HTML Tag maker for RBBCode

For YesPaste i use RBBCode for BBCode parsing and need to have a custom tag : code

By default TagNode doesn't have 'pure' (read: non parsed text...) text, after reading RBBCode code source (yes, there is no DOCUMENTATION) i got it:

 class YesPasteHtmlMaker < RbbCode::HtmlMaker
   def html_from_code_tag(node)
     if node.value.nil?
         lang = 'plaintext'
     else
         lang = node.value
     end
     inner_html = node.children.inject('') do |output, child|
       output + make_html(child).gsub("<br/>", "\n")
     end
     tokens = CodeRay.scan(inner_html, lang).div(:line_numbers => :table)
     return tokens
   end
 end

 def BBCode_render(text)
   html_maker = YesPasteHtmlMaker.new
   parser = RbbCode::Parser.new(:html_maker => html_maker)
   html = parser.parse(text)
   return html
 end

08/12/2009

Magic mimetypes

Tags: C codaz

Pour obtenir le mimetype d'un fichier en C c'est très simple.

La lib magic est parfaite pour ca. man 3 libmagic sous FreeBSD.

Petit example:

BSDmakefile:

 PROG=           mimetype
 LDFLAGS+=       -lmagic
 CFLAGS+=        -Wall -g -ggdb3
 NO_MAN=         yes

 .include <bsd.prog.mk>

Codaz:

 #include <magic.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <err.h>

 int
 main(int argc, char *argv[])
 {
     const char* program_name = argv[0];
     char *filename = argv[1];

     if (filename == NULL) {
         fprintf(stderr, "Usage: %s file\n", program_name);
         return(1);
     }

     struct magic_set *magic = magic_open(MAGIC_MIME_TYPE);
     if (magic == NULL)
         err(1, "magic_set");

     magic_load(magic, NULL);

     printf("%s: %s\n", filename, magic_file(magic, filename));

     magic_close(magic);

     return(0);
 }

07/12/2009

404: Internet not found

Si par malheur tu ne paye pas tes factures d'ADSL chez SFR, tu sera rapellé a l'ordre en te disant "Si tu paye pas on va te couper le net le X/X/XX".

Donc tu va payer les petites factures, une fois payé tu te dis "Voila, c'est fait.".

Tu regarde ton ssh, freezé. Ping de la GW OK, rien qui va vers le monde...

Tu reboot la box, niet. Pseudo synchro mais rien d'autre, tu tel au service client, tu cause avec le robot a la con qui veux que tu tappe sur les touche du tel. Puis un humain finit par te dire : "Ah mais votre ligne a été suspendue pour 5jours."

Alors donc chez SFR, si t'a des factures en retard, que tu les payes, on te coupe le net pendant une semaine.

Sans te prévenir rien, merci. Vraiment merci...

/me regarde le pauvre HTC pendu a la fenètre au bout d'un usb de 5m sharant la 3G over le wifi....

04/12/2009

cacavidia dans ton freebsd

Et voila pleins de nouveau caca proprio pour ton joli FreeBSD.

La daube, c'est par la.

28/11/2009

YesPaste beta !

Voila, la première beta de YesPaste a vu le jour !

Elle est accessible via : http://beta.yespaste.net/

Site du projet : http://brokk.etoilebsd.net/projects/show/yespaste

Sources sous license BSD : http://hg.brokk.etoilebsd.net/yespaste/summary

28/11/2009

Nginx apache-like combined log

It's easy:

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                '$status $body_bytes_sent "$http_referer" '
                '"$http_user_agent" "$http_x_forwarded_for"';

And now, awstats eats your log without problem :)

16/11/2009

CSysinfo.

Mon dernier jouet en C : CSysinfo.

Un PHPSysinfo-like, statique, et qui met <1s a généré contre une 10aine pour phplolsysinfo.

Plus d'infos et examples ici.

12/11/2009

HWSTAT Released

J'ai release hier mon tool en CLI, appelé hwstat.

Il est assez similaire à ``envstat'' sous NetBSD.

Plus d'infos et examples ici.

06/11/2009

I can haz mercurial on mai forge !

Ceci est ma suite du post de l'ami Bapt ici : .

Ici je vais ajouter Mercurial à brokk.

La chose est sous NetBSD avec pkgin d'amour.

Installation de mercurial :

# pkgin in mercurial
calculating dependencies for mercurial...
nothing to upgrade.
3 packages to be installed: libffi-3.0.8nb2 python25-2.5.4nb3 mercurial-1.3.1 (12M to download, 52M to install)
proceed ? [y/N] y
[snip]
processing local summary...
updating database: 100%
marking mercurial-1.3.1 as non auto-removeable
#

Compliqué hein ?

Pour nos dépots, on fera tout sous l'utilisateur hg et dois avoir un shell, en effet, ici le push via ssh sera utilisé :

groupadd hg
useradd -m -g hg -s /bin/sh hg

Configuration du hg serve en fastcgi.

Créer un /home/hg/web/ :

# mkdir /home/hg/web

Installer et configurer le hgwebdir.fcgi :

# cd /tmp
# ftp http://mercurial.selenic.com/release/mercurial-1.3.1.tar.gz
# gunzip mercurial-1.3.1.tar.gz
# tar xvf mercurial-1.3.1.tar
# cd mercurial-1.3.1/contrib
# cp hgwebdir.fcgi /home/hg/web/
# chmod +x /home/hg/web/hgwebdir.fcgi
# vim /home/hg/web/hgwebdir.fcgi

Ajouter au tout début apres le premier commentaire :

import os
os.chdir("/home/hg")

A la dernière ligne, modifier 'hgweb.config' en 'hgweb.conf'. Décomenter

os.environ["HGENCODING"] = "UTF-8"

Et ajouter juste en dessous

os.environ['HGRCPATH'] = 'hgrc'

Maintenant le lighttpd.

Activez les modules 'rewrite' et 'fastcgi' puis voici le vhost a utiliser :

$HTTP["host"] =~ "hg.monsuperdomaine.tld" {
    accesslog.filename = "/var/log/lighttpd/hg_brokk_etoilebsd_net_access"

    url.rewrite-once = ( "^(/hgwebdir.fcgi/.*)$" => "$1", "^(/.*)$" => "/hgwebdir.fcgi$1")

    fastcgi.server = (
        "/" => (
            "hgwebdir" => (
                "bin-path" => "/home/hg/web/hgwebdir.fcgi",
                "socket" => "/tmp/hg.socket",
                "check-local" => "disable",
            )
        )
    )
}

La config 'hgweb.conf' est la suivante :

# cat /home/hg/hgweb.conf
[collections]
/home/hg/public-repos  = /home/hg/public-repos

[web]
baseurl =
encoding = UTF-8
style   = monoblue
motd = Brokk at your service sir! - A <a href="http://brokk.etoilebsd.net/" target="_blank">Brokk forge</a> service.
allow_archive = gz zip bz2

Il nous reste le compte SSH de l'utilisateur 'hg' a configurer, on est toujours dans '/tmp/mercurial-1.3.1/' :

# cp hg-ssh /home/hg/
# chmod +x /home/hg/hg-ssh
# su hg
$ cd
$ pwd
/home/hg
$ ssh-keygen -t dsa
enter, enter, enter ...
$ ssh-keygen -t rsa
enter, enter, enter ...
$ cd .ssh
$ vim authorized_keys

On remplit 'authorized_keys' avec ce qui suit :

command="/usr/pkg/bin/python2.5 /home/hg/hg-ssh public-repos/mon_super_repos",no-port-forwarding,no-X11-forwarding,no-agent-forwarding ssh-dss BLAHBLAHSAYMAKLEEAMOIPOUET

Ici, public-repos/mon_super_repos peux être sous la forme public-repos/{repos1,repos2} ou private-repos/, le dossier private-repos/* ne sera pas vu via l'interface web.

Maintenant lancez votre lighttpd

# /etc/rc.d/lighttpd start

Puis accédez a votre url définie dans la config du lighttpd, et voila :)

UPDATES:

  1. Ajout encoding et paths dans le hgwebdir.fcgi (Merci geekounet)

Pages : 1 2