1 2 3 4 5 |
$ sudo nano /etc/dnsmasq.conf // add line "conf-dir=/etc/dnsmasq.d" if not existing $ sudo nano /etc/dnsmasq.d/98-hostrecords-dns.conf // add line "host-record=mydomain.org,192.168.0.122" $ sudo pihole restartdns |
Category Archives for Coding
IntelliJ: Gradle task mit jedem Reimport ausführen
IntelliJ bietet per Rechtsklick die Möglichkeit, Trigger für Tasks anzuhaken (Screenshot aus der Doku geklaut):
Via build.gradle
kann man das über das Plugin “gradle-idea-ext-plugin” automatisieren – im Rootprojekt:
1 2 3 4 5 6 7 |
apply plugin: 'org.jetbrains.gradle.plugin.idea-ext' buildscript { dependencies { classpath "org.jetbrains.gradle.plugin.idea-ext:org.jetbrains.gradle.plugin.idea-ext.gradle.plugin:0.7" } } |
Und im Unterprojekt dann:
1 2 3 |
idea.project.settings.taskTriggers { beforeSync tasks.getByName("jaxb") } |
Achtung, in DSL spec v. 0.2 heißt es
beforeSync
– before each Gradle project sync. Will NOT be executed on initial import
ka, aber spätestens danach funktioniert es.
Grafana/Docker: Local installation of plugins
Ubuntu/AdoptOpenJDK: Zertifikat importieren
1 2 |
cd /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64 sudo keytool -importcert -file '/path/to/my.cer' -keystore lib/security/cacerts -alias "myAlias" -trustcacerts -storepass changeit |
Obacht: Den Alias darf (sollte) man anpassen, aber das Passwort ist tatsächlich “changeit” 🙃
WiX: Escape echo
CustomAction führt ein Kommando aus, und das ist bspw. ein Shell-Befehl. In diesem Fall ein echo in eine Datei:
1 2 3 4 5 6 |
<CustomAction Id="echo_some_stuff" Directory="INSTALLDIR" Execute='deferred' Impersonate='no' ExeCommand='cmd.exe /s /c "echo foobar>>file.txt"' Return='check' /> |
Will man als Teil von “foobar” jetzt Sonderzeichen mit ausgeben, muss man XML-, WiX-/MSI-, und CMD-Escaping kombinieren – oder man hält sich einfach eine Waffe an den Kopf, das geht schneller:
WiX: Install features options
Das Feature-Element hat einige UI-relevante Attribute, die nicht selbsterklärend sind:
Absent='disallow'
schaltet “The feature will not be installed” aus – wie man für mandatorische Features das Dropdown insgesamt deaktiviert, weiß ich nicht. Ja, man kann das ganze Feature verstecken (Display='hidden'
), aber nicht nur das Dropdown 🤷🏻♂️AllowAdvertise='no'
schaltet “The feature will be installed when needed” aus- “The feature and all of its subfeatures will be installed locally” (in früheren Versionen auch “Entire feature will be installed on local hard drive”) kann laut Internet nicht entfernt werden… andere Quellen legen nahe, dass man das über die Subfeatures und Komponenten steuert, aber ich hatte damit keinen Erfolg.
Gradle: Replace in Copy task
Eine Ersetzung:
1 2 3 4 5 |
task fooBar(type: Copy) { from file("${projectDir}/foo/bar.xml") into("${projectDir}/xy/z") filter { line -> line.replaceAll('someString', 'someReplacement') } } |
Mehrere Ersetzungen:
1 2 3 4 5 6 7 8 9 10 11 |
import org.apache.tools.ant.filters.ReplaceTokens task fooBar(type: Copy) { from file("${projectDir}/foo/bar.xml") into("${projectDir}/xy/z") filter(ReplaceTokens, tokens: [ // requires targets to be wrapped in '@', like '@someString@': 'someString' : 'someReplacement', 'someOtherString': 'someOtherReplacement', ]) } |
Vagrant Invalid value VBOXSVGA
VBoxManage.exe: error: Error in (line 120) — Invalid value ‘VBOXSVGA’ in Display/@controller attribute.
Kann offenbar passieren, wenn eine VM unter Linux erstellt und dann unter Windows gestartet wird. Lösung: Die .ovf-Datei der VM öffnen, und
1 |
<Display controller="VBoxSVGA" VRAMSize="128"/> |
in
1 |
<Display VRAMSize="128"/> |
ändern. Beides von hier.
PowerShell: Zertifikatsprüfung deaktivieren
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Add-Type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } } "@ [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy Invoke-WebRequest 'https://127.0.0.1:8444/my/endpoint' -OutFile 'c:\response.json' |
via. PS, in einem Vagrantfile so zu escapen – man beachte auch die Einrückungen:
1 2 3 4 5 6 7 |
config.vm.provision "disable cert validation callback", type: "shell", inline: <<-SHELL Add-Type @" ... "@ [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy Invoke-WebRequest 'https://127.0.0.1:8444/my/endpoint' -OutFile 'c:\\response.json' SHELL |
HTH
Gradle: Include/exclude tests
Exclude set of tests (via) and/or categories:
1 2 3 4 5 6 7 8 9 |
task junitSystemTest(type: Test) { systemProperties = System.properties def runSeparately = ['**/FirstSpec*', '**/SecondSpec*'] useJUnit { includeCategories 'com.acme.SystemTest' exclude runSeparately } } |
Pass collection from shell (via, and):
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// ./gradlew junitSystemTest -PexcludeTests=**/FirstSpec*,**/SecondSpec* task junitSystemTest(type: Test) { systemProperties = System.properties useJUnit { includeCategories 'com.acme.SystemTest' if (project.hasProperty('excludeTests')) { project.properties['excludeTests'].split(',').each { exclude it } } } } |
Run single test only (via):
1 |
./gradlew junitSystemTest --tests FirstSpec* |
Exclude all tests from build task:
1 |
./gradlew clean build -x test |
to be completed