Skip to content

Instantly share code, notes, and snippets.


Petar Petrov petarov

View GitHub Profile
petarov /
Created Oct 12, 2018
MyBatis Microsoft OffsetDateTimeTypeHandlerJDBC42
public class OffsetDateTimeTypeHandlerJDBC42 extends BaseTypeHandler<OffsetDateTime> {
public void setNonNullParameter(PreparedStatement ps, int i, OffsetDateTime parameter, JdbcType jdbcType)
throws SQLException {
ps.setObject(i, parameter);
public OffsetDateTime getNullableResult(ResultSet rs, String columnName) throws SQLException {
petarov / .gitignore
Created Jun 20, 2018 — forked from maaku/.gitignore
BIP specifying fast merkle trees, as used in the Merkle branch verification opcodes
petarov /
Last active Apr 27, 2017
Security and Crypto
# 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

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:

View Raspberry Pi



  • `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 /
Created Jan 22, 2016 — forked from cr7pt0gr4ph7/
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 {
    // will select org.springframework:spring-tx:4.0.5.RELEASE
petarov / The Technical Interview Cheat
Last active Aug 29, 2015 — forked from TSiege/The Technical Interview Cheat
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
petarov / Multiple PHP versions on
Created Mar 22, 2015
Multiple PHP versions on Archlinux
View Multiple PHP versions on

This describes the steps required to configure multiple PHP versions on your development system, if you have issue using the AUR package. Normally one may install the AUR package on a custom path, .e.g, /usr/local/php, but if you are like me having some issues with that you might want to try a custom compile.

Pay attention to step 6) as this is where any required extensions are enabled. For this setup we generally need pdo and mysql extensions.

  1. Download PHP version 5.3.13 (or any version that you are interested in) from

  2. Download the php53 AUR package from

petarov /
Last active May 29, 2018
Arch Linux Hints and Tricks

Mouse and Keyboard power off

Do you use an usb mouse and keyboard and have laptop_mode installed under your Arch linux ? Then maybe you have the same problems as me - mouse and keyboard getting inactive every 2 seconds or so.

To solve this, go to /etc/laptop-mode/conf.d and copy usb-autosuspend.conf to /etc/laptop-mode/conf.d/board-specific. After that run lsusb and get the ID of the usb device you want, e.g., 093a:2500 .

Open the board-specific/usb-autosuspend.conf file and find the AUTOSUSPEND_USBID_BLACKLIST conf option. Put the desired usb IDs there. You might need to run sudo laptop_mode afterwards to reload the configs.

You can’t perform that action at this time.