Can dpkg verify files from an installed package?

I don’t thinks so, in Ubuntu md5 checksums are only stored for certain files. For any given package the list of files that have checksums can be found in /var/lib/dpkg/info/<package>.md5sums e.g /var/lib/dpkg/info/openssh-server.md5sums These generally don’t contain a complete list of the files that have been installed by a package e.g. openssh-server.md5sums bb5096cf79a43b479a179c770eae86d8 usr/lib/openssh/sftp-server 42da5b1c2de18ec8ef4f20079a601f28 usr/sbin/sshd …

Read more

C-like structures in Python

Update: Data Classes With the introduction of Data Classes in Python 3.7 we get very close. The following example is similar to the NamedTuple example below, but the resulting object is mutable and it allows for default values. from dataclasses import dataclass @dataclass class Point: x: float y: float z: float = 0.0 p = …

Read more

Java 8 Distinct by property

Consider distinct to be a stateful filter. Here is a function that returns a predicate that maintains state about what it’s seen previously, and that returns whether the given element was seen for the first time: public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { Set<Object> seen = ConcurrentHashMap.newKeySet(); return t -> seen.add(keyExtractor.apply(t)); } …

Read more

How to interpolate variables in strings in JavaScript, without concatenation?

You can take advantage of Template Literals and use this syntax: `String text ${expression}` Template literals are enclosed by the back-tick (` `) (grave accent) instead of double or single quotes. This feature has been introduced in ES2015 (ES6). Example var a = 5; var b = 10; console.log(`Fifteen is ${a + b}.`); // “Fifteen …

Read more