^ Added in Java 8 (2014)
^ Optional is a solution to a problem. The problem of null
. But, what is null
?
init_config: | |
mibs_folder: /mibs | |
profiles: | |
generic: | |
definition_file: _generic-host-resources.yaml | |
instances: | |
- ip_address: $REPLACE_WITH_SYNOLOGY_IP_ADDRESS | |
community_string: public | |
snmp_version: 2 |
# Rather than create a whole new hass component, this minimal `rest` sensor configuration is sufficient for a | |
# high-quality National Weather Service point forecast. | |
# See https://forecast-v3.weather.gov/documentation for details on this point-based GeoJSON forecast and more. | |
# Thanks to the National Weather Service for their efforts providing timely weather data to protect life and property. | |
sensor Forecast: | |
- platform: rest | |
name: Forecast | |
resource: https://api.weather.gov/points/[LATITUDE],[LONGITUDE]/forecast # substitute your EPSG:4326 lat/long | |
value_template: "{{ value_json.properties.periods[0].name }}: {{ value_json.properties.periods[0].detailedForecast }}" | |
headers: |
#!/bin/zsh -ex | |
# Restores a compressed Subversion dump to a new Subversion repository with its original repository UUID. | |
# Uses `svndumptool` to ensure improper EOLs in svn:log and svn:ignore are fixed. | |
# Paths are hardcoded, but easily changed to suit needs. | |
repo=$1 | |
cd /data/svn | |
source svnenv/bin/activate | |
gunzip /extract/Recover/${repo}.gzip -c | pv -eta > ${repo}.svn | |
svndumptool.py eolfix-revprop svn:log ${repo}.svn ${repo}.eolfix-revprop-log.svn | |
rm ${repo}.svn |
/** | |
* Safely gets the first element of a {@link List} | |
* @param list a {@code List} | |
* @param <E> type of elements in list | |
* @return the first element of list or {@link Optional#absent()} if absent or null | |
*/ | |
@Nonnull | |
private <E> Optional<E> first(@Nullable List<E> list) { | |
if (list == null || list.isEmpty()) { | |
return Optional.absent(); |