3 liens privés
Useful RAID commands :
# Conf mdadm
cat /etc/mdadm.conf
# Current md stats
cat /proc/mdstat
# detail on a MD device :
mdadm --query --detail /dev/md3
# detail on partition
mdadm --examine /dev/sda3
Complete with OVH RAID help
# Copy partition table from safe disk to new disk (for GPT partition - see fdisk -l)
sgdisk -R /dev/newdisk /dev/safedisk
# afterwards, you have to randomize the GUID on the new hard disk to ensure that they are unique (from [howto forge](https://www.howtoforge.com/tutorial/linux-raid-replace-failed-harddisk/))
sgdisk -G /dev/sdb
# check partitions are copied
sgdisk -p /dev/safedisk
sgdisk -p /dev/newdisk
# Add each partition to RAID cluster :
mdadm --manage /dev/mdX2 --add /dev/newdiskX2
mdadm --manage /dev/mdX1 --add /dev/newdiskX1
# follow reconstruction with
mdam --detail /dev/mdX
or
cat /proc/mdstat
# Rebuild Status : 21% complete
Pour nettoyer entre autre les historiques des fichiers LFS :
- Lister les fichiers LFS
git lfs ls-files -a -s
- download jar
- create a clean copy the repo (git clone)
- execute :
java -jar bfg-1.14.0.jar --delete-files database-hpa.tar.gz hpa-portal
git reflog expire --expire=now --all && git gc --prune=now --aggressive
Pire design de réglage de volume, il y en a qui sont vraiment terrible :) Beaucoup de random, mais ce ne sont pas les mieux.
orginalement reddit (bien sur) :
(via évidemment https://sebsauvage.net/links/?e0Quog)
Error in subbash :
export extractor_version=$(cd extractor; mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
result in output contains colors output :
1.0'$'\033''[0m.tar.gz'
Remove it with :
./somescript | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g"
Dump cache values
unbound-control dump_cache
Installation :
(https://memo-linux.com/debian-installer-le-serveur-dns-unbound/)
apt install unbound
cd /var/lib/unbound/
wget ftp://ftp.internic.net/domain/named.cache
mv named.cache root.hints && chown unbound:unbound root.hints
mv /etc/unbound/
unbound.conf.d/root-auto-trust-anchor-file.conf root-auto-trust-anchor-file.conf.original
mkdir /var/log/unbound
chown unbound: /var/log/unbound
# modify apparmor (see at the end)
systemctl restart unbound
Configuration file:
server:
statistics-interval: 0
extended-statistics: yes
statistics-cumulative: yes
verbosity: 3
interface: 127.0.0.1
port: 53
do-ip4: yes
do-ip6: yes
do-udp: yes
do-tcp: yes
access-control: 127.0.0.0/8 allow ## j'autorise mon serveur
access-control: 0.0.0.0/0 refuse ## j'interdis tout le reste de l'Internet !
auto-trust-anchor-file: "/var/lib/unbound/root.key"
root-hints: "/var/lib/unbound/root.hints"
hide-identity: yes
hide-version: yes
harden-glue: yes
harden-dnssec-stripped: yes
use-caps-for-id: yes
cache-min-ttl: 3600
cache-max-ttl: 86400
prefetch: yes
num-threads: 6
msg-cache-slabs: 16
rrset-cache-slabs: 16
infra-cache-slabs: 16
key-cache-slabs: 16
rrset-cache-size: 256m
msg-cache-size: 128m
so-rcvbuf: 1m
unwanted-reply-threshold: 10000
do-not-query-localhost: yes
val-clean-additional: yes
#use-syslog: yes
#val-log-level:2 (0: default, nothing, 2: full)
logfile: /var/log/unbound/unbound.log
harden-dnssec-stripped: yes
cache-min-ttl: 3600
cache-max-ttl: 86400
prefetch: yes
prefetch-key: yes
And an additional apparmor configuration to be able to write in a dedicated file :
(https://b4d.sablun.org/blog/2018-09-27-when-unbound-wont-write-logs/)
vim /etc/apparmor.d/local/usr.sbin.unbound
# Site-specific additions and overrides for usr.sbin.unbound.
# For more details, please see /etc/apparmor.d/local/README.
/var/log/unbound/unbound.log rw,
A tester.
Partage d'écran et prise de commande à distance (dont android)
Sous le coude: Choisir ses clés primaires sous Postgres.
via sebsauvage (https://sebsauvage.net/links/?vtwJpQ)
Open a H2 database :
java -jar com.h2database.h2-2.1.214.jar
or squirrelSQL
add driver with com.h2database.h2-2.1.214.jar.
Default credentials
login : sa
password : password
UPDATE OCTOER 2022
If you want to quickly start the Restore process and don't care about having that option always enabled, then just fire up the Developer console on the browser and run this while on the Restore page
var modelimport = new Ai1wm.Import();
var storage = Ai1wm.Util.random(12);
var options = Ai1wm.Util.form('#ai1wm-backups-form').concat({ name: 'storage', value: storage }).concat({ name: 'archive', value: 'REPLACE-WITH-ARCHIVE-NAME'});
// Set global params
modelimport.setParams(options);
// Start import
modelimport.start();
Limits the used bandwidth, specified in Kbit/s.
scp -l 1000 file user@remote:/path/to/dest/
Reminder classloader, classname :
Exit0.class.getSimpleName() = Exit0
Exit0.class.getCanonicalName() = com.gorki.Exit0
<instance>.getClass().getSimpleName() =
<instance>.getClass().getCanonicalName() = null
<instance>.getClass().getName() = com.gorki.Exit0$1
<instance>.getClass().getTypeName() = com.gorki.Exit0$1
<instance>.getClass().getPackage().getName() = com.gorki
<instance>.getClass().isAnonymousClass() = true
With :
package com.gorki;
import java.util.ArrayList;
import java.util.Random;
public class Exit0 {
public static void main(String... args) {
Runnable t = new Runnable() {
@Override
public void run() {
}
};
System.out.println("Exit0.class.getSimpleName() = " + Exit0.class.getSimpleName());
System.out.println("Exit0.class.getCanonicalName() = " + Exit0.class.getCanonicalName());
System.out.println("<instance>.getClass().getSimpleName() = " + t.getClass().getSimpleName());
System.out.println("<instance>.getClass().getCanonicalName() = " + t.getClass().getCanonicalName());
System.out.println("<instance>.getClass().getName() = " + t.getClass().getName());
System.out.println("<instance>.getClass().getTypeName() = " + t.getClass().getTypeName());
System.out.println("<instance>.getClass().getPackage().getName() = " + t.getClass().getPackage().getName());
System.out.println("<instance>.getClass().isAnonymousClass() = " + t.getClass().isAnonymousClass());
}
}
pop culture
merci sebsauvage (comment souvent)
Search for microsoft activation kit (official online download and installation)
https://github.com/massgravel/
See licence key at
https://www.cjs-cdkeys.com
Best practices shell, to improve :
When printing error messages, please redirect to stderr.
Use echo 'Something unexpected happened' >&2 for this.
And also :
Use set -o xtrace, with a check on $TRACE env variable.
For copy-paste: if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi.
This helps in debugging your scripts, a lot. Like, really lot.
People can now enable debug mode, by running your script as TRACE=1 ./script.sh instead of ./script.sh.
The problem is most engineers don’t want to do operations work.
So true ! I'm interested in. I want to know how OPs work. I don't want to do it every day :D
Test htaccess rules
Outil de comparaison voiture électrique/thermique :
Epub
Generate a self certificate without adding altName with the IP can lead to an error
The reason this error in java 1.8.0_181 is because this update includes security improvements for LDAP support
-Dcom.sun.jndi.ldap.object.disableEndpointIdentification=true