Skip to content

Instantly share code, notes, and snippets.

View petarov's full-sized avatar
♠️

Petar Petrov petarov

♠️
View GitHub Profile
@petarov
petarov / letsencrypt_ntfy_ubuntu.sh
Last active March 27, 2025 20:49
Let's Encrypt Certificate Expiry Push Notification via ntfy.sh
#!/bin/bash
MAIN_DIR="/etc/letsencrypt/live"
THRESHOLD_DAYS=7
EXPIRY_LOG="/tmp/cert_expiry.log" # Log file to track expiry dates
ALERT_URL="ntfy.sh/<your-topic>"
touch "$EXPIRY_LOG"
# Function to check expiry and send alert
@petarov
petarov / net.vexelon.petarov.name.plist
Last active September 25, 2024 10:11
macOS launchd scheduled run
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.vexelon.petarov.name</string>
<key>ProgramArguments</key>
<array>
<string>/<path>/<executable></string>
<string>/<path>/<param></string>
What's New in Managing Apple Devices
https://developer.apple.com/videos/play/wwdc2022/10045/
===
= Notes by Matt (Tyger) Lemieux ~ Editorial remarks are my own (and marked as such) as are mistakes and errors in interpretation.
= They are not the opinions or interpretations of Apple or my employers. Your milage may vary.
===
== Previous Announcement Recap ==
@petarov
petarov / Hex_Perf_Tests.java
Created February 15, 2022 07:51
Java Test
import org.bouncycastle.util.encoders.Hex;
import java.util.HexFormat;
class Scratch {
public static void main(String[] args) throws Exception {
var data = new byte[] { 23, 42, 127, 31, 12, 0, -1, 109, 87, 0, -1, 0, -1, -42, -19, 96, 23, 42, 127, 31, 12,
0, -1, 109, 87, 0, -1, 0, -1, -42, -19, 96, 23, 42, 127, 31, 12, 0, -1, 109, 87, 0, -1, 0, -1, -42, -19,
96, 23, 42, 127, 31, 12, 0, -1, 109, 87, 0, -1, 0, -1, -42, -19, 96, 23, 42, 127, 31, 12, 0, -1, 109,
@petarov
petarov / OffsetDateTimeTypeHandlerJDBC42.java
Created October 12, 2018 19:27
MyBatis Microsoft OffsetDateTimeTypeHandlerJDBC42
public class OffsetDateTimeTypeHandlerJDBC42 extends BaseTypeHandler<OffsetDateTime> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, OffsetDateTime parameter, JdbcType jdbcType)
throws SQLException {
ps.setObject(i, parameter);
}
@Override
public OffsetDateTime getNullableResult(ResultSet rs, String columnName) throws SQLException {
@petarov
petarov / .gitignore
Created June 20, 2018 11:11 — forked from maaku/.gitignore
BIP specifying fast merkle trees, as used in the Merkle branch verification opcodes
*~
@petarov
petarov / encrypt_with_aes.sh
Last active April 27, 2017 09:14
Security and Crypto
#!/bin/bash
# Encrypts input data using AES-CBC-128 without salt
# Key and IV passed as text parameters and converted to OpenSSL Hex formatted inputs.
# Outputs encrypted data as Base64 encoded text.
if [ "$1NULL" = "NULL" ]; then
echo "Usage - $0 [key] [iv] [data]"
exit 1
fi
@petarov
petarov / Atlassian-Bamboo-Systemd.md
Last active January 25, 2017 16:16
Linux Scripting

Bamboo as a Systemd Service

Make Atlassian Bamboo start as a Systemd service on Linux (CentOS).

Add a new bamboo user and group as explained in the Atlassian's tutorial.

useradd --create-home -c "Bamboo role account" bamboo

Make sure the binary and home directories are owned by the new user:

@petarov
petarov / Raspberry Pi Revisions.md
Last active April 27, 2017 09:15
Raspberry Pi

Scheme

SRRR MMMM PPPP TTTT TTTT VVVV

  • `S scheme (0=old, 1=new)
  • R RAM (0=256, 1=512, 2=1024)
  • M manufacturer (0='SONY',1='EGOMAN',2='EMBEST',3='UNKNOWN',4='EMBEST')
  • P processor (0=2835, 1=2836)
  • T type (0='A', 1='B', 2='A+', 3='B+', 4='Pi 2 B', 5='Alpha', 6='Compute Module')
@petarov
petarov / README.md
Created January 22, 2016 21:17 — forked from cr7pt0gr4ph7/README.md
Gradle Dependency Resolution

Gradle Dependency Resolution

Normal Gradle behavior

The default behavior of Gradle to pick the newest version also applies if a lower version has been declared locally, but another dependency transitively pulls in a newer version. This is in contrast with Maven, where a locally declared version will always win.

For example, if your build.gradle specifies the dependency org.springframework:spring-tx:3.2.3.RELEASE, and another dependency declares 4.0.5.RELEASE as a transitive dependency, then 4.0.5.RELEASE will take precedence:

dependencies {
    compile("org.springframework.data:spring-data-hadoop:2.0.0.RELEASE")
    compile("org.springframework:spring-tx:3.2.3.RELEASE")

// will select org.springframework:spring-tx:4.0.5.RELEASE