Auston Matthews |
Friday, June 16, 2017
Wednesday, June 14, 2017
Tuesday, June 13, 2017
Shigeaki Koga (古賀茂明): Foreign Correspondents' Club of Japan (日本外国特派員協会): メディアと安倍政権の裏側を語る
- Amman (アンマン)
- Jordan (ヨルダン)
- Central Intelligence Agency
- CIAの拠点
- Noriyuki Yamaguchi (山口敬之)
- 警察官僚の中村格(なかむらいたる)
- Itaru Nakamura (中村格)
- Kisha club (記者クラブ)
- 報道ステーションと電通
- オリンピックと電通
- テレビ朝日
ラベル:
Amman,
Central Intelligence Agency,
Dentsu,
ISILによる日本人拘束事件,
Jordan,
Kisha club,
アンマン,
ヨルダン,
中央情報局,
記者クラブ,
電通
Sunday, June 11, 2017
Saturday, June 10, 2017
Friday, June 9, 2017
macOS Sierra: Bash (Unix shell): Associative Array Example: Reading from CSV into Array
Command:
$ cat associative_array3.sh
Result:
#!/bin/bash
aa=()
while IFS=, read -ra line; do if [ -n "${line[0]}" ]; then aa+=("${line[0]}::${line[3]}");fi;done < List\ of\ organisms\ by\ population.csv
total=0
for k in "${aa[@]}"
do
value="${k##*::}"
total=$((total + value))
done
echo "Total population: $total"
LC_CTYPE=C; MIN=1; MAX=$total; while rnd=$(cat /dev/urandom | tr -dc 0-9 | fold -w${#MAX} | head -1 | sed 's/^0*//;'); [ -z $rnd ] && rnd=0; (( $rnd < $MIN || $rnd > $MAX)); do :; done;
echo "Random index: $rnd"
index=$rnd
current=0
for k in "${aa[@]}"
do
value="${k##*::}"
current=$((current + value))
if [ $index -le $current ]
then
name="${k%%::*}"
population=$value
break
fi
done
echo "$name (population: $population)"
printf "Probability: "
echo "$population/$total" | bc -l
Command:
$ ./associative_array3.sh
Result:
Total population: 13958220136
Random index: 8955227583
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 4227209587
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 7805864096
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 8511144278
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 3892081176
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 2589979307
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 7946872317
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 372258826
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 13908122684
Short-eared owl (population: 2000000)
Probability: .00014328474408006714
Result:
Total population: 13958220136
Random index: 7247815301
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 9352855300
Domestic sheep (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 9642135454
Domestic sheep (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 11711491958
Cat (population: 600000000)
Probability: .04298542322402014307
Result:
Total population: 13958220136
Random index: 3990365909
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 272907397
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 9041133545
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 7777621570
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 9017444984
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 4118816981
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 3797333834
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 12061584807
Mourning dove (population: 475000000)
Probability: .03403012671901594660
Result:
Total population: 13958220136
Random index: 12170053267
Mourning dove (population: 475000000)
Probability: .03403012671901594660
Result:
Total population: 13958220136
Random index: 531916373
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 10657946193
Domestic goat (population: 850000000)
Probability: .06089601623402853602
Result:
Total population: 13958220136
Random index: 13481628295
Collared trogon (population: 50000000)
Probability: .00358211860200167858
Result:
Total population: 13958220136
Random index: 9130914826
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 7627418145
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 12225242832
Mourning dove (population: 475000000)
Probability: .03403012671901594660
Result:
Total population: 13958220136
Random index: 3731595661
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Total population: 13958220136
Random index: 11796334858
Cat (population: 600000000)
Probability: .04298542322402014307
Result:
Total population: 13958220136
Random index: 7477886491
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Total population: 13958220136
Random index: 760089938
Human (population: 7350000000)
Probability: .52657143449424675272
$ cat associative_array3.sh
Result:
#!/bin/bash
aa=()
while IFS=, read -ra line; do if [ -n "${line[0]}" ]; then aa+=("${line[0]}::${line[3]}");fi;done < List\ of\ organisms\ by\ population.csv
total=0
for k in "${aa[@]}"
do
value="${k##*::}"
total=$((total + value))
done
echo "Total population: $total"
LC_CTYPE=C; MIN=1; MAX=$total; while rnd=$(cat /dev/urandom | tr -dc 0-9 | fold -w${#MAX} | head -1 | sed 's/^0*//;'); [ -z $rnd ] && rnd=0; (( $rnd < $MIN || $rnd > $MAX)); do :; done;
echo "Random index: $rnd"
index=$rnd
current=0
for k in "${aa[@]}"
do
value="${k##*::}"
current=$((current + value))
if [ $index -le $current ]
then
name="${k%%::*}"
population=$value
break
fi
done
echo "$name (population: $population)"
printf "Probability: "
echo "$population/$total" | bc -l
Command:
$ ./associative_array3.sh
Result:
Total population: 13958220136
Random index: 8955227583
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 4227209587
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 7805864096
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 8511144278
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 3892081176
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 2589979307
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 7946872317
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 372258826
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 13908122684
Short-eared owl (population: 2000000)
Probability: .00014328474408006714
Result:
Random index: 7247815301
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 9352855300
Domestic sheep (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 9642135454
Domestic sheep (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 11711491958
Cat (population: 600000000)
Probability: .04298542322402014307
Result:
Random index: 3990365909
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 272907397
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 9041133545
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 7777621570
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 9017444984
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 4118816981
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 3797333834
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 12061584807
Mourning dove (population: 475000000)
Probability: .03403012671901594660
Result:
Random index: 12170053267
Mourning dove (population: 475000000)
Probability: .03403012671901594660
Result:
Random index: 531916373
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 10657946193
Domestic goat (population: 850000000)
Probability: .06089601623402853602
Result:
Random index: 13481628295
Collared trogon (population: 50000000)
Probability: .00358211860200167858
Result:
Random index: 9130914826
Domestic pig (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 7627418145
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 12225242832
Mourning dove (population: 475000000)
Probability: .03403012671901594660
Result:
Random index: 3731595661
Human (population: 7350000000)
Probability: .52657143449424675272
Result:
Random index: 11796334858
Cat (population: 600000000)
Probability: .04298542322402014307
Result:
Random index: 7477886491
Cattle (population: 1000000000)
Probability: .07164237204003357179
Result:
Random index: 760089938
Human (population: 7350000000)
Probability: .52657143449424675272
Subscribe to:
Posts (Atom)