Skip to content

Instantly share code, notes, and snippets.

View pero86's full-sized avatar

pero86 pero86

View GitHub Profile
@ctrueden
ctrueden / locations.txt
Last active March 11, 2023 12:56
Where is libjvm in various JDKs?
$ for f in *.tar.gz
do
echo
echo "[$f]"
result=$(tar tf "$f" | grep -i 'jvm\.\(dll\|dylib\|so\)$')
test "$result" && echo "$result" || echo "--> NOTHING FOUND"
done; for f in *.zip
do
echo
echo "[$f]"
@lisawolderiksen
lisawolderiksen / git-commit-template.md
Last active June 30, 2025 05:48
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

@merikan
merikan / Jenkinsfile
Last active June 7, 2025 23:07
Some Jenkinsfile examples
Some Jenkinsfile examples
@codan-telcikt
codan-telcikt / geometry_geojson.yaml
Last active September 3, 2023 11:47 — forked from bubbobne/geometry_geojson.yaml
An OpenAPI definition for GeoJSON with Geometry and Features.
# MIT License
#
# Copyright (c) 2017 Daniele Andreis <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@jbarop
jbarop / echo_server.kt
Last active May 25, 2020 20:16
A simple echo server using non blocking IO in Kotlin
import java.net.InetSocketAddress
import java.nio.ByteBuffer
import java.nio.channels.SelectionKey
import java.nio.channels.Selector
import java.nio.channels.ServerSocketChannel
import java.nio.channels.SocketChannel
import java.util.*
/**
* Represents a server.
@apzentral
apzentral / ant-sshexec-build.xml
Last active April 11, 2023 18:00
ANT: sshexec template
<!-- Build Script for ANT -->
<project basedir="." default="" name="Build Script">
<property name="username" value="username"/>
<property name="passwd" value="passwd"/>
<property name="keyfile-path" value="/path-to-private-key"/>
<property name="applicationFolder" value="/var/www/html/"/>
<property name="sandboxRoot" value="${basedir}"/>
@leowinterde
leowinterde / Gitlab Permissions Fix
Created January 11, 2018 10:21
gitlab-ce permissions fix
# Holds repositories directory
sudo chown -R -v git:root /var/opt/gitlab/git-data
sudo chmod -R -v 0700 /var/opt/gitlab/git-data
# Holds git repositories
sudo chown -R -v git:git /var/opt/gitlab/git-data/repositories
sudo chmod -R -v 2770 /var/opt/gitlab/git-data/repositories
# Holds large object directories
sudo chown -R -v git:gitlab-www /var/opt/gitlab/gitlab-rails/shared
@lovubuntu
lovubuntu / Sha256.kt
Created November 24, 2017 15:58
function to generate Sha-256 in Kotlin
Class Hasher {
fun hash(): String {
val bytes = this.toString().toByteArray()
val md = MessageDigest.getInstance("SHA-256")
val digest = md.digest(bytes)
return digest.fold("", { str, it -> str + "%02x".format(it) })
}
}
1. Setup a project
2. Add groovy SDK support:
https://www.bonusbits.com/wiki/HowTo:Add_Groovy_SDK_to_IntelliJ_IDEA
3. Download http://(yourjenkinsurl)/job/(yourpipelinejob)/pipeline-syntax/gdsl
- this will give you the .gdsl file - download this to the src folder of your project.
4. Finally follow this step - right click on the src folder -> Mark directory as -> Sources Root

The knight is the piece in the game of chess that, in one turn, can move two squares horizontally and one square vertically or two squares vertically and one square horizontally.

An infinite chessboard is given. All of its squares are empty except for the square with coordinates (0,0), where a knight stands.

Write a function:

def solution(A, B)

that, given two numbers A and B, returns the minimum number of turns required for the knight to move from square (0,0) to square (A,B). The function should return -1 if the knight cannot reach the given square. The function should return -2 if the required number of turns exceeds 100,000,000.