At time of writing GitHub packages only support authenticated usage, see thread on confirmation here: https://github.community/t5/GitHub-API-Development-and/Download-from-Github-Package-Registry-without-authentication
Your GITHUB_USERNAME
is your GitHub username.
You can generate a GITHUB_TOKEN
using you GitHub personal account setting area, it will need access to packages.
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/BenManwaring/Permutations"
credentials {
username = System.getenv("GITHUB_USERNAME")
password = System.getenv("GITHUB_TOKEN")
}
}
}
dependencies {
implementation 'com.benmanwaring:permutations:1.0.6'
}
val stringPermutations = "AB".permutations(2)
for (stringPermutation in stringPermutations) {
System.out.println(stringPermutation)
}
AA
AB
BA
BB
val stringPermutations = "AB".permutations(1..3)
for (stringPermutation in stringPermutations) {
System.out.println(stringPermutation)
}
A
B
AA
AB
BA
BB
AAA
AAB
ABA
ABB
BAA
BAB
BBA
BBB
val stringPermutations = ('A'..'C').permutations(2)
for (stringPermutation in stringPermutations) {
System.out.println(stringPermutation)
}
AA
AB
AC
BA
BB
BC
CA
CB
CC
val stringPermutations = ('A'..'C').permutations(1..3)
for (stringPermutation in stringPermutations) {
System.out.println(stringPermutation)
}
A
B
C
AA
AB
AC
BA
BB
BC
CA
CB
CC
AAA
AAB
ABA
...
val binaryPermutations = listOf(0, 1).permutations(2)
for (binaryPermutation in binaryPermutations) {
System.out.println(binaryPermutation.joinToString(separator = ", "))
}
0, 0
0, 1
1, 0
1, 1
val binaryPermutations = listOf(0, 1).permutations(1..3)
for (binaryPermutation in binaryPermutations) {
System.out.println(binaryPermutation.joinToString(separator = ", "))
}
0
1
0, 0
0, 1
1, 0
1, 1
0, 0, 0
0, 0, 1
0, 1, 0
0, 1, 1
1, 0, 0
1, 0, 1
1, 1, 0
1, 1, 1
val binaryPermutations = arrayOf(0, 1).permutations(2)
for (binaryPermutation in binaryPermutations) {
System.out.println(binaryPermutation.joinToString(separator = ", "))
}
0, 0
0, 1
1, 0
1, 1
val binaryPermutations = arrayOf(0, 1).permutations(1..3)
for (binaryPermutation in binaryPermutations) {
System.out.println(binaryPermutation.joinToString(separator = ", "))
}
0
1
0, 0
0, 1
1, 0
1, 1
0, 0, 0
0, 0, 1
0, 1, 0
0, 1, 1
1, 0, 0
1, 0, 1
1, 1, 0
1, 1, 1
Copyright 2020 Ben Manwaring
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.