Skip to content

Instantly share code, notes, and snippets.

View michael-o's full-sized avatar

Michael Osipov michael-o

  • Innomotics (A Siemens Business)
  • Berlin, Germany
  • 11:25 (UTC +02:00)
View GitHub Profile
@grahamperrin
grahamperrin / freebsd-12-to-13.md
Last active September 17, 2023 19:33
Upgrade FreeBSD 12.⋯ to FreeBSD 13

Preamble

If you want future FreeBSD update and upgrade routines to be simpler: please support the PkgBase initiative. See, for example, https://alpha.pkgbase.live/.


Guidance below is for 12.⋯ systems that:

  • fall below 12.2-RELEASE-p4 (12.2 patch level 4)
  • boot from ZFS (not UFS).
@Hanny2010
Hanny2010 / redis_proxy_connection.py
Last active March 13, 2024 02:45
Connect to Redis server over Squid Proxy
import socket
from redis.client import Redis
from redis.connection import Connection, ConnectionPool
from redis._compat import iteritems
class ProxyConnection(Connection):
def __init__(self, host='localhost', port=6379, db=0, password=None,
socket_timeout=None, socket_connect_timeout=None,
socket_keepalive=False, socket_keepalive_options=None,
package systextil.commons.io.path;
import java.io.File;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeMapped;
import com.sun.jna.PointerType;
import com.sun.jna.win32.W32APIOptions;
@julianxhokaxhiu
julianxhokaxhiu / java.sh
Last active July 21, 2021 20:08
How to pass system properties with spaces in Java within your Bash scripts
#!/usr/bin/env bash
######################################################################################################################
# This script is a solution of when you want to pass Java options when they do come to the script as environment
# variable, or when you declare them inside a variable, using quotes. When you do so, you may obtain from the Java
# process an error that looks like this:
#
# $ ./java.sh
# Error: Could not find or load main class ...
#
@darbyluv2code
darbyluv2code / web.xml
Created February 24, 2019 20:23
web.xml for servlet 4 (requires Tomcat 9)
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
</web-app>
@amr
amr / ConfigurationLoader.java
Last active November 11, 2023 18:43
Java simple YAML/JSON/Properties configuration mechanism with environment variable substitution/interpolation
public class ConfigurationLoader {
private final ObjectMapper objectMapper;
private final StringSubstitutor stringSubstitutor;
ConfigurationLoader() {
this.objectMapper = new ObjectMapper(new YAMLFactory());
this.stringSubstitutor =
new StringSubstitutor(StringLookupFactory.INSTANCE.environmentVariableStringLookup());
}
@xan7r
xan7r / decryptKerbTicket.py
Last active April 10, 2024 04:29
Decrypt kerberos tickets and parse out authorization data
#!/usr/bin/env python2
# NOTE: this script was created for educational purposes to assist learning about kerberos tickets.
# Likely to have a few bugs that cause it to fail to decrypt some TGT or Service tickets.
#
# Recommended Instructions:
# Obtain valid kerberos tickets using Rubeus or mimikatz "sekurlsa::tickets /export"
# Optionally convert tickets to ccache format using kekeo "misc::convert ccache <ticketName.kirbi>"
# Obtain appropriate aes256 key using dcsync (krbtgt for TGT or usually target computer account for Service Ticket)
# Run this script to decrypt:
# ./decryptKerbTicket.py -k 5c7ee0b8f0ffeedbeefdeadbeeff1eefc7d313620feedbeefdeadbeefafd601e -t ./Administrator@TESTLAB.LOCAL_krbtgt~TESTLAB.LOCAL@TESTLAB.LOCAL.ccaches
@ipan
ipan / diff-jq.md
Created January 16, 2018 04:47
compare two JSONs with jq #json #jq
@wesleyegberto
wesleyegberto / web.xml
Created March 7, 2017 22:29
web.xml for Servlet 3.1
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app>
@moisseev
moisseev / Postfix-SASL-client.md
Last active October 28, 2022 09:15
Replacing the default FreeBSD system mailer Sendmail with Postfix using SMTP AUTH, acting as mail client

Replacing the default FreeBSD system mailer Sendmail with Postfix using SMTP AUTH, acting as mail client

Replacing Sendmail with Postfix

# pkg install postfix-sasl1

Would you like to activate Postfix in /etc/mail/mailer.conf [n]? y2

# service sendmail stop