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.

@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 / The Technical Interview Cheat Sheet.md
Last active August 29, 2015 14:28 — forked from tsiege/The Technical Interview Cheat Sheet.md
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.

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

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