Skip to content

Instantly share code, notes, and snippets.

View nightspotlight's full-sized avatar

Roman Eremeev nightspotlight

  • Poland
  • 09:37 (UTC +02:00)
View GitHub Profile
@nightspotlight
nightspotlight / LUKS_and_TPM2_with_Fedora.md
Last active January 17, 2023 09:07 — forked from jdoss/LUKS_and_TPM2_with_Fedora.md
Decrypt LUKS volumes with a TPM on Fedora 35+

Decrypt LUKS volumes with a TPM on Fedora 35+

This guide allows you to use the TPM on your computer to decrypt your LUKS encrypted volumes. If you are worried about a cold boot attack on your hardware please DO NOT use this guide with your root volume!

Preflight Checks

Verify that you have a TPM in your computer:

# systemd-cryptenroll --tpm2-device=list
PATH DEVICE DRIVER
@nightspotlight
nightspotlight / gcloud-activate.sh
Created July 30, 2020 18:36
Switch your Google Cloud service accounts on the command line
# put this in your ~/.profile, then reload your shell
function gcloud-activate() {
local action="$1"
local account=""
local credentials=""
case "${action}" in
alpha)
account="alpha-cicd@my-project-alpha.iam.gserviceaccount.com"
credentials="${HOME}/.config/gcloud/my-project-alpha.json"
@nightspotlight
nightspotlight / nexus-rpm-multiupload.sh
Created July 6, 2020 09:33
Upload multiple RPM files to a Maven repository in Sonatype Nexus Repository Manager 2
#!/usr/bin/env bash
for f in *.rpm; do
rpminfo="$(rpm -qp --queryformat "%{NAME} %{VERSION}-%{RELEASE} %{ARCH}\n" "${f}" 2>/dev/null)"
group="org.centos-7.rpm"
artifact="$(echo "${rpminfo}" | cut -d ' ' -f 1)"
version="$(echo "${rpminfo}" | cut -d ' ' -f 2)"
classifier="$(echo "${rpminfo}" | cut -d ' ' -f 3)"
curl -fsSL \
-u nexus_user:nexus_password \
@nightspotlight
nightspotlight / ipv6.sh
Last active October 27, 2019 21:03
Enable IPv6 inside a FreeBSD jail (FreeNAS-11.2-U3)
#!/bin/sh
/sbin/ifconfig epair0b inet6 auto_linklocal accept_rtadv autoconf
/sbin/rtsol epair0b
# sysrc rtsold_enable=YES
# service rtsold start
@nightspotlight
nightspotlight / mdns.sh
Last active April 22, 2019 12:54
Enable mdns inside a FreeBSD jail (FreeNAS-11.2-U3)
# # cat /usr/local/etc/pkg/repos/FreeBSD.conf
# FreeBSD: { enabled: no }
rm -f /usr/local/etc/pkg/repos/FreeBSD.conf
pkg update -f
pkg install --yes openmdns
sysrc mdnsd_enable=yes
sysrc mdnsd_flags=epair0b
service mdnsd start
@nightspotlight
nightspotlight / datetime.groovy
Last active June 22, 2018 20:41
A Groovy script to display given time in different timezones
#!/usr/bin/env groovy
//TimeZone.setDefault(TimeZone.getTimeZone('Europe/Warsaw'))
if (args.size() == 0 || !args.find { it ==~ /^\d{2}\.\d{2}\.\d{4}\ \d{2}\:\d{2}$/ }) {
String thisScript = new File(this.getClass().protectionDomain.codeSource.location.path).getName()
System.err.println "Error parsing command line arguments!"
System.err.println "Usage: ${thisScript} <dateTime>"
System.err.println "Accepted dateTime format is dd.mm.yyyy hh:mm"
System.err.println "Example: ${thisScript} '25.05.2018 05:00'"
@nightspotlight
nightspotlight / windows10-ipv6-stateful.bat
Created August 20, 2017 19:06
Windows script to disable random IPv6 address and IPv6 privacy extensions
netsh interface ipv6 set privacy state=disabled store=active
netsh interface ipv6 set privacy state=disabled store=persistent
netsh interface ipv6 set global randomizeidentifiers=disabled store=active
netsh interface ipv6 set global randomizeidentifiers=disabled store=persistent
netsh interface ipv6 set interface 15 routerdiscovery=disabled
netsh interface ipv6 set interface 15 managedaddress=enabled
netsh interface ipv6 set interface 15 otherstateful=enabled
@nightspotlight
nightspotlight / jenkins_email-ext-plugin_html-custom.jelly
Last active February 8, 2022 12:17
Jelly template to display table with JUnit test results for Jenkins Email-ext plugin
<?jelly escape-by-default='true'?>
<!DOCTYPE html [
<!ENTITY nbsp "&#38;#38;nbsp&#59;">
]>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
<body>
<!-- GENERAL INFO -->
<table>
<tr>
<td align="right">
@nightspotlight
nightspotlight / reset-github.bat
Created November 26, 2016 20:18
Completely reset GitHub for Windows
RMDIR /S /Q %USERPROFILE%\AppData\Roaming\GitHub
RMDIR /S /Q %USERPROFILE%\AppData\Local\GitHub
RMDIR /S /Q %USERPROFILE%\.ssh
DEL /F /Q %USERPROFILE%\.gitconfig