Skip to content

Instantly share code, notes, and snippets.

View petarov's full-sized avatar
🏴

Petar Petrov petarov

🏴
View GitHub Profile
@petarov
petarov / ArchLinux-USB-Powersave.md
Last active June 11, 2023 10:58
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.

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 / Multiple PHP versions on Archlinux.md
Created March 22, 2015 13:44
Multiple PHP versions on Archlinux

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 http://php.net/releases/

  2. Download the php53 AUR package from https://aur.archlinux.org/packages/php53/

@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 / 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 / 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 / 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