Various tips about things that I can never remember when using Linux, OpenBSD, Apache, LaTeX and a few other computery tools.
Split this page and use tags!
setxkbmap -layout us -variant intl -options "lv3:ralt_switch_multikey"
Dans /etc/hal/fdi/policy, par exemple 10-x11-input.fdi (templates are usually found in /usr/share/hal/fdi/policy/):
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<!-- FIXME: Support tablets too. -->
<match key="info.capabilities" contains="input.mouse">
<merge key="input.x11_driver" type="string">mouse</merge>
<match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
string="Linux">
<merge key="input.x11_driver" type="string">evdev</merge>
</match>
</match>
<match key="info.capabilities" contains="input.keys">
<!-- If we're using Linux, we use evdev by default (falling back to
keyboard otherwise). -->
<merge key="input.x11_driver" type="string">keyboard</merge>
<match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
string="Linux">
<merge key="input.x11_driver" type="string">evdev</merge>
</match>
<match key="info.product" string="Dell Dell USB Keyboard">
<merge key="input.x11_options.XkbModel" type="string">dellusbmm</merge>
</match>
<merge key="input.x11_options.XkbOptions" type="string">lv3:ralt_switch_multikey</merge>
<merge key="input.x11_options.XkbVariant" type="string">intl</merge>
</match>
</device>
</deviceinfo>
Dans /etc/hal/fdi/policy/11-x11-input-synaptics.fdi:
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
<device>
<match key="info.capabilities" contains="input.touchpad">
<match key="info.product" contains="Synaptics TouchPad">
<merge key="input.x11_driver" type="string">synaptics</merge>
<!-- Arbitrary options can be passed to the driver using
the input.x11_options property since xorg-server-1.5. -->
<!-- EXAMPLE:
<merge key="input.x11_options.LeftEdge" type="string">120</merge>
-->
</match>
<match key="info.product" contains="AlpsPS/2 ALPS">
<merge key="input.x11_driver" type="string">synaptics</merge>
</match>
<match key="info.product" contains="appletouch">
<merge key="input.x11_driver" type="string">synaptics</merge>
</match>
<match key="info.product" contains="bcm5974">
<merge key="input.x11_driver" type="string">synaptics</merge>
</match>
</match>
<match key="input.x11_driver" string="synaptics">
<merge key="input.x11_options.SHMConfig" type="string">true</merge>
<merge key="input.x11_options.VertEdgeScroll" type="string">true</merge>
<merge key="input.x11_options.HorizEdgeScroll" type="string">true</merge>
<merge key="input.x11_options.CornerCoasting" type="string">true</merge>
<merge key="input.x11_options.TapButton1" type="string">1</merge>
<merge key="input.x11_options.TapButton2" type="string">2</merge>
<merge key="input.x11_options.RightEdge" type="string">900</merge>
<merge key="input.x11_options.BottomEdge" type="string">700</merge>
<merge key="input.x11_options.EmulateTwoFingerMinZ" type="string">90</merge>
<merge key="input.x11_options.VertTwoFingerScroll" type="string">true</merge>
<merge key="input.x11_options.HorizTwoFingerScroll" type="string">true</merge>
</match>
</device>
</deviceinfo>
In the .htaccess file:
AuthUserFile /PATH/TO/.htpasswd
AuthName "Nice name"
AuthType Basic
<Limit GET>
require valid-user
</Limit>
Create and maintain the .htpasswd file:
$ htpasswd -c /PATH/TO/.htpasswd user1 New password: Re-type new password: Adding password for user user1 $ htpasswd /PATH/TO/.htpasswd user2 New password: Re-type new password: Adding password for user user2
La clé:
$ openssl genrsa -out server.key 1024
La requète de certificat:
$ openssl req -new -key server.key -out server.csr
Le certificat:
$ openssl x509 -req -days 1000 -in server.csr -signkey server.key -out server.crt
Convertir un certificat binaire en pem:
$ openssl x509 -inform der -in certificate.crt -out certificate.pem
Référence: How to generate self-signed SSL certificates
Changer la passphrase d'une clé:
$ openssl rsa -in server.key -out server-newpass.key -passout "pass:PASS"
Voir le contenu d'un(e) demande de certificat/certificat/clé:
$ openssl req|x509|rsa -in cert.crt -text
Plusieurs noms pour un seul certificat (vu ici). Dans openssl-custom.cnf (ou celui du système, mais c'est moins propre):
[req] ... req_extensions = v3_req ... [ v3_req ] # Extensions to add to a certificate request basicConstraints = CA:FALSE keyUsage = nonRepudiation, digitalSignature, keyEncipherment # Some CAs do not yet support subjectAltName in CSRs. # Instead the additional names are form entries on web # pages where one requests the certificate... subjectAltName = @alt_names [alt_names] DNS.1 = IPADDRESS DNS.2 = SECONDNAME DNS.3 = THIRDNAME ...
Puis on génère le certificat comme à l'habitude mais en spécifiant le fichier de configuration à utiliser en plus:
$ openssl req -config openssl-custom.cnf -new -key server.key -out server.csr
In `$JAVA_HOME/lib/swing.properties`:
# Swing properties swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
If java complains with a
Unexpected error: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
odds are that the $JAVA_HOME/jre/lib/security/cacerts file is empty (i.e. it's only 32 Bytes in size).
To recreate it from, say, Mozilla's list of trusted certificates, the following (tested on ArchLinux) can be done:
for FILE in /usr/share/ca-certificates/mozilla/*.crt; do
keytool -deststorepass changeit -import -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -file $FILE -alias `basename ${FILE/.crt/}` -noprompt
done
Le .procmailrc:
:0 $HOME/mbox
Le .mutt(ng)rc:
set mbox="~/mbox" set spoolfile="~/mbox"
Et bien mieux.
Xft.dpi: 100 dans ~/.Xresourcesxrdb -load ~/.Xresources dans ~/.xsession (si nécessaire)Peut aussi marcher:
apt-get install xfonts-base-transcoded
nfs:/data/Sources on /data/Sources type nfs (rw,rsize=32768,wsize=16384,timeo=3,retrans=5,acregmin=1,acregmax=30,acdirmin=10,acdirmax=60,retry=1000,namlen=255,port=2049,mountprog=100005,nfsprog=100003,posix,bg,hard,intr,noac,udp,addr=192.168.1.64)
lambda-d5.mtek.chalmers.se:/lfs/d5.dd/mehani on /chalmers/users/mehani type nfs (rw,nosuid,hard,intr,grpid,proto=tcp,addr=129.16.61.41)
mount -oloop,offset=sector_size*partition_start -t vfat /opt/qemu/tempImage /mnt/tempImage
En général sector_size=512 et partition_start=63.
Pour être sûr:
fdisk -lu /opt/qemu/tempImage
pstoedit -f plot-svg fichier.eps fichier.svg´
Les noms des images sont du type img00.jpg à 50 Hz :
$ ffmpeg -f image2 -i img%02d.jpg -r 50 -vcodec mpeg4 vid.avi
Two-sided printing option for landscape documents:
lpr -o sides=two-sided-short-edge
Two-sided printing with proper folding depending on the printing orientation (i.e. tumble when landscape printing), in /etc/a2ps/a2ps-site.cfg:
Printer: atp-b15-nl2-p1 | #{lp} #o #?l|-oDuplex=DuplexTumble||
or (simpler)
Options: -s2
And stapling:
Variable: lp.options | #{lp} #o #?l|"-oStaple=1Staple(Left)"|"-oStaple=1Staple(Right)"|
Prevent psnup (and other psutils) from cancelling two-sided printing, as per this post.
Still in /etc/a2ps/a2ps-site.cfg:
Variable: forceduplex \
cat /etc/a2ps/duplex.ps -
Variable: forcetumble \
cat /etc/a2ps/tumble.ps -
Variable: lp.hook \
#?d! #?l|#{forcetumble}|#{forceduplex}| | !!
With PS headers duplex.ps and tumble.ps setting the right options.
This can be done using pdftk.
$ pdftk form.pdf fill_form data.fdf output data.pdf
Unfortunately, the project seems to be dead…
PPPd and PPTPClient are needed for this to work
Using the PPTPClient-provided options, one can quickly create a new peer in, say, /etc/ppp/peers/pptppeer:
file /etc/ppp/options.pptp name LOGIN pty "/usr/sbin/pptp PPTPSERVER --nolaunchpppd" #debug #nodetach
Of course, the password needs to be added to the /etc/ppp/chap-secrets file:
# client server secret IP addresses LOGIN * PASSWORD *
Once a network connection has been established, the routes may have to be taken care of before and/or after the establishment of the :
$ sudo route add PPTPSERVER DEFAULTGW $ sudo pppd call pptppeer $ sudo route add default gw PPTPPEERGW
Where DEFAULTGW is the default route _before_ the PPTP link has been established, and PPTPPEERGW is the remote endpoint of the P-t-P connection.
First emerge the necessary package
$ sudo emerge pptpclient pppd
Then configure the new interface, with dependencies and needed route setup in /etc/conf.d/net:
config_ppp0=( "ppp" )
link_ppp0="pty 'pptp PPTPSERVER --nolaunchpppd'"
username_ppp0='LOGIN'
password_ppp0='PASSWORD'
pppd_ppp0=(
"noauth"
"defaultroute"
"holdoff 3"
"child-timeout 60"
"lcp-echo-interval 15"
"lcp-echo-failure 3"
noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp persist
)
depend_ppp0() {
depend net
}
preup() {
case $1 in
ppp0)
route add PPTPSERVER gw DEFAULTGW
return 0
;;
*)
;;
esac
}
postup() {
case $1 in
ppp0)
route add default gw PPTPPEERGW dev $1
return 0
;;
*)
;;
esac
}
predown() {
case $1 in
ppp0)
route del default gw PPTPPEERGW
return 0
;;
*)
;;
esac
}
postdown() {
case $1 in
ppp0)
route del PPTPSERVER gw DEFAULTGW
return 0
;;
*)
;;
esac
}
Finally, the startup link has to be created, and can be used directly:
$ sudo ln -s /etc/init.d/net.lo /etc/init.d/net.ppp0 $ sudo /etc/init.d/net.ppp0 start