Skip to content

Instantly share code, notes, and snippets.

@k0staa
k0staa / TransactionServiceTest.kt
Created June 19, 2020 15:34
Kotlin mocking transaction. Mockk, Kotest, Exposed
@Component
class SomeTransactionalService(
private val someDao: SomeDao
) {
fun handle(parameter: String) {
transaction {
eventDao.updateEvent(parameter)
}
}
curl -XPOST -H 'Content-Type: application/json' 'http://localhost:9202/some_index/_update_by_query' -d '{
"script" : "ctx._source.remove(\"some_field\")"
}'
@k0staa
k0staa / wait-for.sh
Created May 6, 2020 07:07
wait-for script using /health endpoint
#!/bin/sh
#Usage in docker-compose.yml:
# scripts:
# build: scripts
# depends_on:
# - "app-tomcat"
# command: sh -c '/wait-for.sh app-tomcat:8080 -- sh /entrypoint.sh'
#
#entrypoint.sh is run after script connect to application /health endpoint
#Install arch on usb, it have script (arch-chroot) , its very usefull (adds /dev /proc /sys mounts and more)
#When on live usb run:
sudo pacman -S lvm2
sudo vgchange -a y
#Now you are able to see LVM drives and mount them
#Boot volume is on separte partition
#Prepare and mount volumes:
sudo mkdir /newroot
sudo mount /dev/yourVG/rootLV /newroot
sudo mount /dev/yourbootpartition /newroot/boot
@k0staa
k0staa / DeleteJobHistory.groovy
Last active October 13, 2017 12:28
Deletes job history and set job build number to 1
def jobName = "APP-RELEASE"
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().each { it.delete() }
// uncomment these lines to reset the build number to 1:
job.nextBuildNumber = 1
job.save()