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
// No one knows why Amazon doesn't simply provide a total of item prices for wishlists. | |
// But with a little script in the F12 Developer Console, you can calculate a total. | |
Array.from(document.getElementsByClassName("g-item-sortable")) | |
.map((i) => { | |
return /\$([0-9.]+)/.exec(i.innerText)[1] - 0 | |
}) | |
.reduce((a,b) => { | |
return a+b | |
}) | |
.toLocaleString([], { |
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
if findmnt -M /mnt >/dev/null 2>&1; then | |
umount /mnt | |
fi | |
DISK_LEADIN_BYTES=$(fdisk -l /dev/xvdb | awk ' | |
/^Device.* Start .* End / { | |
# Input line will be like: | |
# | |
# Device Boot Start End Sectors Size Id Type | |
# |
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
import java.util.Map; | |
import java.util.SortedMap; | |
import java.util.TreeMap; | |
public class Dice { | |
public static void main(String[] args) { | |
SortedMap<Long, Long> zeroSixSidedDice = sumOccurrencesOfDiceRoll(6, 0); | |
SortedMap<Long, Long> singleSixSidedDie = sumOccurrencesOfDiceRoll(6, 1); | |
SortedMap<Long, Long> twoSixSidedDice = sumOccurrencesOfDiceRoll(6, 2); | |
SortedMap<Long, Long> threeSixSidedDice = sumOccurrencesOfDiceRoll(6, 3); |
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 -e | |
if [ $# -ne 2 -o ! "$1" = "--region" ]; then | |
echo "Usage: ${0##*/} --region <aws-region>" 2>&1 | |
exit 1 | |
fi | |
AWS_REGION="$2" | |
AWS_OPTIONS+=" --region $AWS_REGION --output json" |
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
import java.util.ArrayDeque; | |
import java.util.ArrayList; | |
import java.util.Deque; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.PriorityQueue; | |
import static java.lang.Math.min; | |
import static java.util.stream.Collectors.counting; | |
import static java.util.stream.Collectors.groupingBy; |
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
@Unroll | |
"LD X, [M] -> #value.hex32"() { | |
setup: | |
Rx3588Processor processor | |
rom.put(0x00 as byte) | |
rom.putInt(value as int) | |
when: | |
processor = new Rx3588Processor().attachRom(rom.array()) | |
processor.setRegister("M", 1) |
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 -e | |
set -o pipefail | |
referrer() { | |
local -n reference="$1" | |
echo "In referrer: ${!reference}" | |
reference=reassigned | |
} |
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 -e | |
set -o pipefail | |
fail() { | |
echo "$*" >&2 | |
return 1 | |
} | |
verify-utilities-available() { | |
local util |
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 -e | |
set -o pipefail | |
REGION_X=1920 | |
REGION_Y=2210 | |
REGION_WIDTH=320 | |
REGION_HEIGHT=100 | |
RENAME_PATTERN='foo-%s.pdf' | |
for file in "$@"; do |
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 -e | |
set -o pipefail | |
json=$(curl -sS --fail "$PRODUCT_URL" | | |
grep -Po 'Dell.Services.DataModel = .*;' | | |
awk '{sub("Dell.Services.DataModel = ", "");sub(";$", "");print}' | | |
jq '.Stacks[0].Stack' | |
) | |
name=$(jq -r '.Title.InnerValue' <<<"$json") |
OlderNewer