This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Because Ubuntu 22.10 still has Maven 3.6.3, this fixes it: | |
wget -q https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz -P /tmp | |
mkdir ~/sw/ | |
tar xf /tmp/apache-maven-*.tar.gz -C ~/sw/ | |
rm /tmp/apache-maven-*.tar.gz | |
mv /sw/apache-maven-* -C ~/sw/maven | |
echo 'MAVEN_HOME=~/sw/maven' >> ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private inline fun <reified T : OptionEnum> tryParseEnumOption(enumArgumentDefault: T, arg: String): T? { | |
val optionIntro = "--${enumArgumentDefault.optionName}" | |
if (!arg.startsWith(optionIntro)) | |
return null | |
if (arg == optionIntro || arg == optionIntro + "=" + enumArgumentDefault.optionValue) | |
return enumArgumentDefault | |
val valueStr = arg.substringAfter(optionIntro).removePrefix("=") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object OptionsParsingUtils { | |
private inline fun <reified T : OptionEnum> tryParseEnumOption(enumArgumentDefault: T, arg: String): T? { | |
val optionIntro = "--${enumArgumentDefault.optionName}" | |
if (!arg.startsWith(optionIntro)) | |
return null | |
if (arg.endsWith(optionIntro) || arg.endsWith("=${enumArgumentDefault.optionValue}")) | |
return enumArgumentDefault |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## This is not a script, rather a sequence of commands to do. | |
## I have tested it and it works. | |
## Use at your own responsibility. | |
## Compiled from https://www.dionysopoulos.me/apple-display-brightness-controls-in-ubuntu-desktop.html | |
## See https://github.com/yhaenggi/acdcontrol.git for more info. | |
## | |
sudo apt-install g++ make | |
git clone https://github.com/yhaenggi/acdcontrol.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo apt-get install python-picamera | |
import picamera | |
from time import sleep | |
camera = picamera.PiCamera() | |
camera.capture('image.jpg') | |
camera.start_preview() | |
camera.vflip = True | |
camera.hflip = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ch.zizka.time | |
import java.time.Duration | |
import java.time.LocalDateTime | |
import java.time.format.DateTimeFormatter | |
import java.time.format.DateTimeParseException | |
import java.time.temporal.ChronoField.DAY_OF_MONTH | |
import java.time.temporal.ChronoField.HOUR_OF_DAY | |
import java.time.temporal.ChronoField.MINUTE_OF_HOUR | |
import java.time.temporal.ChronoField.MONTH_OF_YEAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -type f -size +3M -print0 | while IFS= read -r -d '' i; do | |
#echo $i | |
echo -n '.' | |
if grep -q "$i" md5-partial.txt; then | |
echo -n ':'; #-e "\n$i ---- Already counted, skipping."; | |
continue; | |
fi | |
#md5sum "$i" >> md5.txt | |
MD5=`dd bs=1M count=1 if="$i" status=none | md5sum` | |
MD5=`echo $MD5 | cut -d' ' -f1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassUtils | |
{ | |
/** | |
* This is intended to scan all TS classes that extend FrameModel. | |
* However there's no supported way to do it | |
* and the one used here may stop working in future TS versions. | |
* Therefore for now, let's rely on the generated DiscriminatorMappingData.ts. | |
*/ | |
public static scanGlobalClasses() : { [key: string]: typeof FrameModel } | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun parseCommaDelimitedMap(str: String): Map<String, String> { | |
if (str == null) return null | |
val pairs = str.split(',').map { it.trim() }.filter { it.contains(':') } | |
.map { | |
val parts = it.split(':', limit = 2) | |
Pair(parts[0], parts[1]) | |
} | |
.associate { it } | |
return pairs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################################################################### | |
# | |
# This script creates switches between the versions of various tools, | |
# found in /mnt/jqa/sw/tools/ (curently hard-coded). | |
# | |
# Usage: | |
# $ switch maven 2.1.0 | |
# $ mvn ... | |
# | |
# Installation: |