Modelo de no-break testado: APC Back-UPS BX 1500BI-BR
Raspberry Pi: RPi 3 Model B+
SO: DietPi v8.25.1
apt-get -y install apcupsd apcupsd-cgi lighttpd
package br.gov.example.demoiselle; | |
import org.demoiselle.signer.core.ca.provider.ProviderCA; | |
import org.demoiselle.signer.core.util.MessagesBundle; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; |
#!/usr/bin/bash | |
# JPG | |
find . -type f -iname "*.jpg" -print0 | xargs -0 -n1 -I % sh -c 'touch % -d "$(file %|grep -oP "datetime=\K[^,]*"|sed -e "s/:/-/"|sed -e "s/:/-/")"' | |
# MP4 | |
find . -type f -iname "*.mp4" -print0 | xargs -0 -n1 -I % sh -c 'touch "%" -d "$(exiftool -s -s -s -CreateDate "%"|grep -oP "[0-9]{4}:[0-9]{2}:[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}"|grep -v 0000|sed -e "s/:/-/"|sed -e "s/:/-/")"' | |
# VID-20181028-WA0001.mp4 | |
find . -type f -iname "VID-*-*.mp4" -print0 | xargs -0 -n1 -I % sh -c 'touch "%" -d "$(echo -n "%"|grep -oP "[0-9]{8}"|sed -r "s/([0-9]{4})([0-9]{2})([0-9]{2})/\1-\2-\3 12:00:00/")"' |
// data = resultado da chamada ao serviço que retorna os eventos | |
let data = require('./data/nubank_events.json'); | |
let rewards_money = 0; | |
let rewards_points = 0; | |
let rewards_count = 0; | |
let hasReward = false; | |
let date = /^(.{10})T(.{8}).*$/; | |
let rewards_netflix = 2600; | |
function getDate(d) { |
#!/bin/bash | |
dolog() { | |
logger -t atom-update "$*" | |
echo "$*" | |
} | |
dolog "Atom auto update started `date`" | |
wget -q https://github.com/atom/atom/releases/latest -O /tmp/latest | |
MATCHEDROW=$(awk -F '[<>]' '/href=".*atom-amd64.deb/' /tmp/latest) | |
LATEST=$(echo $MATCHEDROW | grep -o -P '(?<=href=").*(?=" rel)') |
#!/bin/bash | |
# from: http://stackoverflow.com/a/12500894 | |
PROGRESS_COUNT=0 | |
PROGRESS_TOTAL=100 | |
PROGRESS_START=`date +%s` | |
while [ $PROGRESS_COUNT -lt $PROGRESS_TOTAL ] | |
do | |
# the code | |
sleep 0.5 |
#!/bin/bash | |
_yo_complete() | |
{ | |
local cur_word prev_word type_list | |
cur_word="${COMP_WORDS[COMP_CWORD]}" | |
prev_word="${COMP_WORDS[COMP_CWORD-1]}" | |
type_list=`yo --help | tail -n+8` |
// http://jsperf.com/padleft/2 | |
/** | |
* String.repeat('a', 5) = 'aaaaa' | |
* String.repeat('ab', 5) = 'ababa' | |
* String.repeat('abc', 5) = 'abcab' | |
*/ | |
String.repeat = function repeat(str, len) { | |
while (str.length < len) { | |
if (str.length * 2 >= len) { | |
return str + str.substring(0, len - str.length); |