Table des matières
- 2026:
- 2025:
1 billet(s) pour avril 2026
| Notes ping ICMP | 2026/04/03 23:01 | Jean-Baptiste |
Notes Lazarus
Installation
apt-get install lazarus apt-file search /usr/share/fpcsrc/ |awk '{print $1}' |sort -u apt-get install fpc-source-3.2.2 apt-cache search fppkg apt-get install fp-units-misc
Configuration
Juste après le premier lancement :
“Restore Fppkg configuration”
/usr/lib/x86_64-linux-gnu/fpc
Tools - Options… - Editor - Display - Colors
Forground : Silver
Background : Black
Langages Pascal
Bash CSV
Petit script pour analyser les données d'un fichier CSV
get_info_csv.sh
#! /bin/bash CSV_FILE=$1 COUNT_FIELDS=$(head -1 "$CSV_FILE" | sed -e 's/[^;]//g' | wc | awk '{print $3}') GET_CSV_KEY() { local -i i i=$1 head -1 "$CSV_FILE" | cut -d';' -f"$i" } GET_COUNT_VALUE() { local -i i i=$1 sed -e 1d "$CSV_FILE" | cut -d';' -f"$i" | sort -u | wc -l } GET_UNIQUE_VALUE() { local -i i i=$1 sed -e 1d "$CSV_FILE" | cut -d';' -f"$i" | sort -u } for (( j=1; j<=COUNT_FIELDS; j++ )) do echo -n "[${j}_" COUNT=$(GET_COUNT_VALUE "$j") echo "$(GET_CSV_KEY "$j")]" if [[ COUNT -lt 200 ]] then GET_UNIQUE_VALUE "$j" else echo MUL fi echo "-----" done
Utilisation
source get_info_csv.sh plop.csv # Nom / entête du champ 1 GET_CSV_KEY 1 # Nombre de valeurs différente pour le champ 1 GET_COUNT_VALUE 1 # Récupère toutes les valeurs différentes pour un champ donné GET_UNIQUE_VALUE 4 # Nombre de champ / colonnes echo $COUNT_FIELDS
Autres
Type string vs int
Dans certains cas il est particulièrement gênant de voir le ou les zéros ne pas s'afficher. Exemple :
Agent 7
A la place d'agent 007
Pour faire interpréter (dans LibreOffice / excel..) les données numériques comme des strings et non pas comme des integer l'astuce consiste à faire précéder le chiffre par une tabulation.
Notes langue lang locale Temps timezone TZ
Voir :
Voir aussi :
SystemD
#timedatectl list-timezones timedatectl set-timezone Europe/Paris
Avant SystemD
echo "Europe/Helsinki" > /etc/timezone #dpkg-reconfigure tzdata dpkg-reconfigure --frontend noninteractive tzdata
Debian / Ubuntu
/etc/locale.gen
fr_FR.UTF-8 UTF-8
export LANG=fr_FR.UTF-8 export LANGUAGE=fr_FR:fr export LC_ALL=fr_FR.UTF-8 # LC_ALL=C.UTF-8 locale-gen dpkg-reconfigure locales update-locale LANG=fr_FR.UTF-8
Ou
locale-gen fr_FR.UTF-8 UTF-8 && dpkg-reconfigure locales
/etc/default/keyboard
# KEYBOARD CONFIGURATION FILE # Consult the keyboard(5) manual page. XKBMODEL="pc105" XKBLAYOUT="fr" XKBVARIANT="latin9" XKBOPTIONS="" BACKSPACE="guess"
sudu setupcon
Redhat / CentOS
Source :
Fichier de conf
/etc/locale.conf
LANG=en_US.utf8
Afficher les infos
localectl status
Langue
localectl list-locales #localedef set-locale LANG=en_US.utf8 localedef set-locale LANG=fr_FR.utf8
Clavier
Voir Comment mater le clavier sous Linux?
localectl list-keymaps #localectl set-keymap us localectl set-keymap fr #localectl set-x11-keymap fr
Pb
Pb 1
# loadkeys fr cannot open file fr
Solution
apt-get install kbd console-data
Pb 2
Debian 9
localectl set-keymap fr
Après reboot, lightdm est bien en français par défaut (même si c'est en_US.utf8 qui est affiché)
Par contre la console TTY est toujours en querty.
Il faut à chaque fois faire
loadkeys fr # idem pour X11 setxkbmap fr
loadkeys persistent, loadkeys permanent
Il est possible d'ajouter cette commande dans le bashrc, mais existe-il un autre moyen de rendre pour loadkeys persistent
Solution :
apt-get install console-setup
Si cela ne marche toujours pas
apt-get install console-data apt-get install console-setup apt-get install keyboard-configuration dpkg-reconfigure console-data dpkg-reconfigure console-setup dpkg-reconfigure keyboard-configuration reboot
Debian - set locale
WARNING! Your environment specifies an invalid locale.
The unknown environment variables are:
LC_CTYPE=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_ALL=
This can affect your user experience significantly, including the
ability to manage packages. You may install the locales by running:
sudo apt-get install language-pack-en
or
sudo locale-gen en_US.UTF-8
To see all available language packs, run:
apt-cache search "^language-pack-[a-z][a-z]$"
To disable this message for all users, run:
sudo touch /var/lib/cloud/instance/locale-check.skip
Autres
a
/etc/initramfs-tools/initramfs.conf
#KEYMAP=n KEYMAP=y
update-initramfs -u -k all
b
GRUB_CMDLINE_LINUX=”rd.lvm.lv=centos/swap vconsole.keymap=us crashkernel=auto rd.lvm.lv=centos/root vconsole.font=latarcyrheb-sun16 rhgb quiet net.ifnames=0 biosdevname=0″
grub2-mkconfig -o /boot/grub2/grub.cfg
autres
locale-gen fr_FR.UTF-8 UTF-8
Ce qui revient à créer
/etc/locale.gen
# This file lists locales that you wish to have built. You can find a list # of valid supported locales at /usr/share/i18n/SUPPORTED, and you can add # user defined locales to /usr/local/share/i18n/SUPPORTED. If you change # this file, you need to rerun locale-gen. en_US.UTF-8 UTF-8 fr_FR.UTF-8 UTF-8
update-locale LANG=fr_FR.UTF-8
Ce qui revient à
/etc/default/locale
# File generated by update-locale LANG=fr_FR.UTF-8
dpkg-reconfigure -f noninteractive locales env DEBIAN_FRONTEND=noninteractive apt-get install console-setup
Notes langage C
Voir :
Voir aussi :
- ISO C99
#include <stdio.h> #include <string.h> #include <malloc.h> main(int argc, char **argv) { int i, size; #define SEPARATEUR " " char *cmdline; for (i=1; i < argc; i++) size += strlen(SEPARATEUR) + strlen(argv[i]); cmdline = malloc(size); if (cmdline ) { memset(cmdline, 0, size); for (i=1; i < argc; i++) { strcat(cmdline, argv[i]); strcat(cmdline, SEPARATEUR); } } printf("-- %s --", cmdline); system(cmdline); }
Surcharger un symbole
Voir : https://stackoverflow.com/questions/2146059/limiting-syscall-access-for-a-linux-application
Is the application linked statically?
If not, you may override some symbols, for example, let's redefine socket:
int socket(int domain, int type, int protocol) {
write(1,"Error\n",6);
return -1;
}
Then build a shared library:
gcc -fPIC -shared test.c -o libtest.so
Let's run:
nc -l -p 6000
Ok.
And now:
$ LD_PRELOAD=./libtest.so nc -l -p 6000 Error Can't get socket
What happens when you run with variable LD_PRELOAD=./libtest.so? It overrides with symbols defined in libtest.so over those defined in the C library.
Sécurité
$ man gets
...
(DEPRECATED)
Never use this function.
BUGS
Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the
buffer, it is extremely dangerous to use. It has been used to break computer security. Use fgets() instead.
For more information, see CWE-242 (aka "Use of Inherently Dangerous Function") at http://cwe.mitre.org/data/definitions/242.html
...
Notes SQL
Voir :
Requêtes SQL imbriquées :
SELECT unifiedjob_ptr_id FROM main_job WHERE unifiedjob_ptr_id IN (SELECT id FROM main_unifiedjob WHERE execution_environment_id=3 );
