3 liens privés
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
Java class to test SSL
Additional parameter :
-Djavax.net.debug=ssl,handshake
-Djavax.net.debug=ssl,manager
-Djavax.net.debug=all
A lire
Architecture logicielle
DWService
# check that name is a valid variable name:
# note: this code does not support variable_name[index]
shopt -s globasciiranges
[[ "$name" == [a-zA-Z_]*([a-zA-Z_0-9]) ]] || exit
value='babibab'
eval "$name"='$value' # carefully escape the right-hand side!
echo "$var_37" # outputs “babibab”
Detect virtualized platform
systemd-detect-virt
hostnamectl
lshw -class system
dmidecode -s system-product-name
Pour avoir la description d'une méthode version bytecode :
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.util.concurrent.ThreadPoolExecutor;
public class ByteCodeDescriptor {
public static void main(String... args) {
Class clazz = ThreadPoolExecutor.class;
String result= ByteCodeDescriptor.getDescriptorForClass(clazz);
System.out.println("class = " + result);
for (Method m : ThreadPoolExecutor.class.getMethods()) {
String resultM= ByteCodeDescriptor.getDescriptor(m);
System.out.println("method = " + m);
System.out.println("method result = " + m.getName() + resultM);
}
for (Constructor c : ThreadPoolExecutor.class.getConstructors()) {
String resultM= ByteCodeDescriptor.getDescriptor(c);
System.out.println("constructor = " + c);
System.out.println("constructor result = " + resultM);
}
}
static String getDescriptorForClass(final Class c)
{
if(c.isPrimitive())
{
if(c==byte.class)
return "B";
if(c==char.class)
return "C";
if(c==double.class)
return "D";
if(c==float.class)
return "F";
if(c==int.class)
return "I";
if(c==long.class)
return "J";
if(c==short.class)
return "S";
if(c==boolean.class)
return "Z";
if(c==void.class)
return "V";
throw new RuntimeException("Unrecognized primitive "+c);
}
if(c.isArray()) return c.getName().replace('.', '/');
return ('L'+c.getName()+';').replace('.', '/');
}
static String getDescriptor(Executable e) {
String s = "(";
for (final Class c : e.getParameterTypes())
s += getDescriptorForClass(c);
s += ')';
if (e instanceof Method) {
Method m = (Method) e;
return m.getName() + s + getDescriptorForClass(m.getReturnType());
} else if (e instanceof Constructor) {
Constructor c = (Constructor) e;
return "<init>" + s + getDescriptorForClass(void.class);
}
throw new RuntimeException("Unrecognized primitive "+e);
}
}
Reminder
python3 -m http.server 5051
Notes for openssl
Private key :
# Add a password to a PEM private key file
openssl rsa -aes256 -in unprotected.pem -out protected.pem -passout "pass:toto"
# Read a PEM private key file with password
openssl rsa -in password.pem -passin "pass:toto"
openssl rsa -in password.pem -passin "file:password.txt"
Certificate :
# Read a certificate PEM file
openssl x509 -in certificate.pem
# Fingerprint for the certificate
openssl x509 -noout -in certificate.pem -sha256 -fingerprint
# Certificate chain
openssl x509 -noout -subject -issuer -in certificate.pem
Verify certificate
# sign fil with private key
openssl dgst -sha256 -sign tstpri.pem -out tst.sig fil
# verify the signature with matching public key
openssl dgst -sha256 -verify tstpub.pem -signature tst.sig fil
File extensions can be (very) loosely seen as a type system.
.pem
a base64 encoding with header and footer lines.
The contents of the PEM are detailed in the header and footer line
[Examples](https://stackoverflow.com/questions/5215771/how-can-i-check-if-the-certificate-file-i-have-is-in-pem-format)
CRT
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
PEM
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY----
.der
as PEM this is binary encoding method, conversion :
openssl x509 -in example.pem -out example.der -outform DER
.key
can be any kind of key, but usually it is the private key.
OpenSSL can wrap private keys for all algorithms (RSA, DSA, EC) in a generic and standard PKCS#8 structure
the encoding could be PEM or DER, both can protect the key with password-based
.crt or .cer
stands simply for certificate, usually an X509v3 certificate,
the encoding could be PEM or DER
a certificate contains the public key, but it contains much more information (most importantly the signature by the Certificate Authority over the data and public key, of course).
.csr or .req or sometimes .p10
stands for Certificate Signing Request as defined in PKCS#10;
the encoding could be PEM or DER
it contains information such as the public key and common name required by a Certificate Authority to create and sign a certificate for the requester,
.p12 or .pfx
is a PKCS#12 defined key store, commonly password protected.
It can contain trusted certificates, private key(s) and their certificate chain(s), but also other information such as secret keys and (
p12 is usually binary / DER encoded.
.crl
is a Certificate Revocation List which is defined within the X.509v3 certificate specifications, and this is usually DER encoded as well.