Skip to content

Instantly share code, notes, and snippets.

View ktor's full-sized avatar

Pawel Kruszewski ktor

View GitHub Profile

How to Access LUKS-Encrypted Drives on Windows

This guide provides step-by-step instructions on how to install Windows Subsystem for Linux 2 (WSL 2), set up Debian, and mount LUKS-encrypted drives on a Windows system.

Prerequisites

  • A LUKS-encrypted drive that you want to access.
  • Windows 10 (version 2004 and later) or Windows 11 with support for WSL 2.
  • Administrator privileges on your Windows system.
  • Basic knowledge of command-line operations in PowerShell and Linux.
@ktor
ktor / rm-untagged-images.sh
Created June 23, 2020 23:22
Removes untagged docker images
docker rmi $(docker images | grep '<none>' | awk '{print $3}')
@ktor
ktor / global-jenkins-properties.groovy
Created June 10, 2020 17:52
Access global jenkins properties from jenkins https://plugins.jenkins.io/extensible-choice-parameter/ groovy script
// source: https://stackoverflow.com/a/41160217/1180235
import jenkins.model.*
nodes = Jenkins.instance.globalNodeProperties
nodes.getAll(hudson.slaves.EnvironmentVariablesNodeProperty.class)
envVars = nodes[0].envVars
envVars['MY_GLOBAL_PROPERTY']
@ktor
ktor / combo-servlet-clean-up.groovy
Created May 26, 2020 00:47
Clean up combo servlet cache on one Liferay node
import com.liferay.portal.servlet.ComboServlet;
import com.liferay.portal.servlet.ComboServlet.FileContentBag;
import com.liferay.portal.kernel.cache.SingleVMPoolUtil;
SingleVMPoolUtil.getCache(ComboServlet.class.getName()).removeAll();
SingleVMPoolUtil.getCache(FileContentBag.class.getName()).removeAll();
@ktor
ktor / reload-portal-properties.groovy
Last active May 26, 2020 00:48
Reload portal properties without restart on liferay portal 6.x
// credit: https://stackoverflow.com/questions/11931375/is-it-possible-to-reflect-changes-in-portal-ext-properties-without-restarting-wh/51781616#51781616
import java.lang.reflect.Method;
import com.liferay.portal.kernel.util.PortalClassLoaderUtil;
//Loading the PropsUtil class by using PortalClassLoader
Class<?> prospsUtilClass = PortalClassLoaderUtil.getClassLoader().loadClass("com.liferay.portal.util.PropsUtil");
//getting the reload method of PropsUtil class
Method reloadMethod = prospsUtilClass.getMethod("reload", null);
//Invoking the static reload method
reloadMethod.invoke(null, null);
mvn org.apache.maven.plugins:maven-resources-plugin:copy-resources@copy-dist-css-portlets-to-sass-cache
@ktor
ktor / lightweight-web-server-oneliner-test.sh
Last active March 21, 2020 13:26
Lightweight web server oneliner test with 20s delay in response
#!/bin/sh
printf 'HTTP/1.1 200 OK\n\n%s' "<html>" | nc -l -i 20 -p 8888 localhost
@ktor
ktor / gist:311d64dfd030149c369a9c276204d5d2
Created September 27, 2019 13:47
deploy to different maven repository than defined in pom distributionManagement configuration
mvn clean install org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy -DaltDeploymentRepository=maven-releases::https://host/repository/maven-releases
# Insert your preferred key mappings here.
map <c-d> scrollPageDown
map <c-u> scrollPageUp
map <c-f> scrollFullPageDown
map <c-b> scrollFullPageUp
map <c-o> goBack
map <c-i> goForward
map u restoreTab
@ktor
ktor / gist:a808bc48e72a03162929d71d30f8a3fb
Last active December 12, 2017 11:21
show size of particular files in ZIP
#!/bin/sh
unzip -lv /appl/tmp/data.lar | grep documentlibrary | awk '{sum += $1} END {print sum/1024/1024}'