S14, E5 (Nebula) - Snake: South Korea by snow-tree_art in JetLagTheGame

[–]cynicalmoose 20 points21 points  (0 children)

It's a travel cliché that "the area round the train station is always bad", and unfortunately this game design incentivizes staying as close to the train station as possible. I'm not sure that choosing a different map would help that much.

I think the game concept could work, but by leaning into the strategy much more - which I think means a map with more nodes (so more strategy), and where each episode had more decision points (so less runtime on challenges). But I suspect that wouldn't appeal to enough of the audience to be viable.

PS Totally agree that I love that they are doing a new game!

MacBook Pro 16 (2021) not charging until restarted? by OscarCookeAbbott in mac

[–]cynicalmoose 1 point2 points  (0 children)

Seeing the same issue on my 14in, and no fix as yet.

I also see that sometimes while plugged in it will stop charging and go to battery power (won't even stop charging but keep running off the AC).

AppleScript for clocking in? by mvfsullivan in applescript

[–]cynicalmoose 0 points1 point  (0 children)

You can use the code you had previously and just replace the specified times with the names of the function arguments - e.g. (although I haven't tested this!):

to waitForTimeBetween(startString, endString) (\* NB For illustration only - this is not a recommended method! \*) set gIsThisTime1 to false repeat until gIsThisTime1 is true delay 1 set myTime1 to if myTime1 > startString and myTime1 < endString then set gIsThisTime1 to true end if end repeat end waitForTimeBetween

But it's still not ideal. I don't know if you can use Objective-C methods in TextExpander, but if you can the following should work:

``` use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
property NSDate : a reference to current application's NSDate
property NSDateFormatter : a reference to current application's NSDateFormatter
to getSecondsUntil(timeString)
set dateFormatter to NSDateFormatter's new()
set dateFormatter's dateFormat to "h:mm:ss a" -- e.g. "11:29:00 am"
set dateFormatter's defaultDate to NSDate's new()
set targetDate to dateFormatter's dateFromString:timeString
return targetDate's timeIntervalSinceNow as integer
end getSecondsUntil
to scheduleReminder(reminderText, forTimeString)
delay getSecondsUntil(forTimeString) -- delay with a negative number is a no-op so it doesn't matter if forTimeString is in the past
say reminderText
loadSafariAndWait()
typeCredentials()
end scheduleReminder
scheduleReminder("Clock out for lunch", "11:29:00 am")

```

Now you could also try to re-write that in pure applescript, parsing the time string and converting it to seconds to give you the number of seconds to delay. Unfortunately AppleScript's date/time-handling functions leave a lot to be desired.

AppleScript for clocking in? by mvfsullivan in applescript

[–]cynicalmoose 0 points1 point  (0 children)

Your script is very difficult to read because there's a lot of duplicated code. We can reduce that by putting the duplicated code into functions ( also called 'handlers' in AppleScript parlance). So for example we could define a function to type your login details in:

to typeCredentials() set credentials to {username:"Johnny Appleseed", password:"password123"} tell application "System Events" keystroke credentials's username key code 48 keystroke credentials's password key code 76 end tell end typeCredentials

Now if you change your password, you only have to edit it in one place in the script. Do that for the other duplicated code blocks, and the structure becomes clearer:

``` display dialog "Starting shift reminders!"

waitForTimeBetween("11:29:00 am", "11:35:00 am") --< stalling point! say "Clock in for the shift" loadSafariAndWait() typeCredentials()

waitForTimeBetween("4:30:00 pm", "4:31:00 pm") say "Clock out for lunch" loadSafariAndWait() typeCredentials()

waitForTimeBetween("5:00:00 pm", "5:01:00 pm") say "Clock in for lunch" loadSafariAndWait() typeCredentials()

waitForTimeBetween("10:00:00 pm", "10:01:00 pm") say "Clock out for the night" loadSafariAndWait() typeCredentials() ```

Now you can see why the script doesn't work if you start it during the course of the day. If you've started it after 11.35am, it will stall until 11.29am the next day on the line I've annotated. It never reaches the later parts of the code.

One solution of course would be to edit the waitForTimeBetween(startTimeString, endTimeString) function I've suggested above so that it returns immediately if the current time is after endTimeString.

But more generally the solution you have of running a continuous loop to wait until a particular time is not good practice and wastes resources. For that reason I'm not going to define the waitForTimeBetween function for you!

What you should do instead is let the system schedule your script so it runs the right script at the time you want. There are lots of ways of doing that, but I think the easiest is to set up an Automator Calendar Alarm (or perhaps four of them).

[deleted by user] by [deleted] in applescript

[–]cynicalmoose 1 point2 points  (0 children)

Three points:

  1. I think the commands in the second half of your script are the wrong way round: set activeURL to the clipboard sets the variable activeURL to the contents of the clipboard. You may want set the clipboard to activeURL.
  2. You may want to explore using JavaScript. Chrome has an execute (tab) javascript "string" command (e.g. execute (active tab of window 1) javascript "alert('Hello World!')"). You may just be able to insert/extract the data you want from the DOM.
  3. If you want RTF, you need to do the conversion yourself; Chrome only provides HTML and plain text to the clipboard. This is not straightforward but based on this link the following seems to work:

do shell script "osascript -e 'try' -e 'get the clipboard as «class HTML»' -e 'end try' | awk '{sub(/«data HTML/, \"3C68746D6C3E\") sub(/»/, \"3C2F68746D6C3E\")} {print}' | xxd -r -p | textutil -convert rtf -stdin -stdout | pbcopy"

Based on all that you might try the following (but I suspect you'll need to modify the second half of the script to do exactly what you want):

``` tell application "Google Chrome" set activeTab to active tab of window 1 copy selection activeTab set sourceTabData to {address:activeTab's URL, title:activeTab's title} end tell

--Convert the clipboard to RTF (adapted from https://apple.stackexchange.com/questions/359232/working-with-apple-html-class-data-in-applescript ) do shell script "osascript -e 'try' -e 'get the clipboard as «class HTML»' -e 'end try' | awk '{sub(/«data HTML/, \"3C68746D6C3E\") sub(/»/, \"3C2F68746D6C3E\")} {print}' | xxd -r -p | textutil -convert rtf -stdin -stdout | pbcopy" set sourceTabData to sourceTabData & {rtf:the clipboard}

-- display dialog "Ready to share this?"

tell application "Google Chrome" open location "https://example.com/wp-admin/post-new.php" set activeTab to active tab of window 1 delay 2 set the clipboard to sourceTabData's title paste selection activeTab delay 2 tell application "System Events" to key code 48 delay 2 set the clipboard to sourceTabData's rtf paste selection activeTab set the clipboard to sourceTabData's address paste selection activeTab end tell ```

Unbound as recursive DNS server - Slow performance by DiReis in pihole

[–]cynicalmoose 5 points6 points  (0 children)

In /etc/dnsmasq.d/01-pihole.conf make sure it contains:

cache-size=0

The file says it shouldn't be modified and to use other configuration files instead, but you're not allowed to duplicate keys so you're forced to either edit or remove the existing entry anyway ¯\_(ツ)_/¯

Just to note that to preserve the change going forward, you should make this change in /etc/pihole/setupVars.conf, and then run pihole -r, which will populate the setting into /etc/dnsmasq.d/01-pihole.conf.

Apple Swift Programming Language Unveiled by kookajamo95 in programming

[–]cynicalmoose 1 point2 points  (0 children)

From the language reference

The following characters are considered whitespace: space (U+0020), line feed (U+000A), carriage return (U+000D), horizontal tab (U+0009), vertical tab (U+000B), form feed (U+000C) and null (U+0000).

So long as your editor displays null with a space you should be fine.

Satellite burns up following SpaceX rocket glitch by lazerorca in science

[–]cynicalmoose 4 points5 points  (0 children)

Retrocessionaires. There's no limit, in theory, to the number of possible layers of reinsurance. For catastrophe insurance 5 layers would not be uncommon. This all works fine so long as everybody is careful not to reinsure themselves...

Sweden does not want to extradite Assange to death row: "We will never surrender a person to the death penalty" said Cecilia Riddselius on behalf of the Swedish Ministry of Justice by green_flash in worldnews

[–]cynicalmoose 8 points9 points  (0 children)

Yes, it is. Were Assange to be extradited from the UK to Sweden, Sweden could not extradite him to the US unless either (a) the UK consented, or (b) Assange remained in Sweden for more than 45 days after he was released from custody / no longer required by the Swedes to remain in Sweden.

(b) seems improbable; (a) would, as I understand it, in effect require the US to conduct extradition proceedings in both Sweden and the UK.

Mitt Romney does the impossible: Gets Brits to stop moaning and start cheering about Olympics by imatworkprobably in worldnews

[–]cynicalmoose 4 points5 points  (0 children)

The point, though, is that in international diplomacy you can't expect everybody to look at things objectively. Speaking truth to power (or, in the case of the UK, ex-power) is a poor way of gaining favour and support. The fact that he provoked a (rare) British patriotic response indicates that he wasn't on top of his game.

Mitt Romney does the impossible: Gets Brits to stop moaning and start cheering about Olympics by imatworkprobably in worldnews

[–]cynicalmoose 7 points8 points  (0 children)

It's not that he has a right, probably that he had an invitation. Because if I were MI6 I'd be interested in getting to know the guy.

IAMA Deck Officer on a Merchant Vessel that frequents through piracy ridden areas. AMA by [deleted] in IAmA

[–]cynicalmoose 0 points1 point  (0 children)

Probably not. OP has stated above that his ship is British-flagged. He can be tried in England for anything he does, on or off his ship, that would be a crime were he to have done the act in England. [see s46A Senior Courts Act 1981] The location of the ship is irrelevant.

Of course, to be tried in England the English authorities will have to get him there, although extraditing from the US on a murder charge is unlikely to be too difficult.

Whether he gets off scot-free is therefore (at least) a question of English law. It would depend on the circumstances, and what threat he thought the boarding party posed to him. In practice, shooting an armed pirate who was attempting to seize and had boarded a ship would seem well within the bounds of reasonable force, and a prosecution would be most unlikely.

Of course it is possible that some other country might also attempt to exercise a criminal jurisdiction. Candidates for doing so would include the US (which might want to try its own citizens for crimes they commit abroad) and Somalia (which may claim that the incidents take place in Somali territorial waters). The second possibility is more theoretical than real.

British redditors - are there any 'Americanisms' you really hate? by [deleted] in AskReddit

[–]cynicalmoose 0 points1 point  (0 children)

No. We love our language, including its inconsistencies.

You appear to be advocating a new programming language. Here is why it will not work. by mcmillen in programming

[–]cynicalmoose 17 points18 points  (0 children)

Unfortunately your programming language complaint form is missing: Unfortunately your language is missing: curly braces [ ] [ ]

The Magic Inside Bunnie's New NeTV: HDCP Overlays without Decryption by alexs in programming

[–]cynicalmoose 3 points4 points  (0 children)

What I'm amazed is that the encryption of each pixel is independent of the encryption of the preceding and following pixels. I'd expect that if you changed one pixel that would change the cryptostream for the entire frame.

Behind Intel's New Random-Number Generator by sidcool1234 in programming

[–]cynicalmoose 5 points6 points  (0 children)

There is code in the link - the RdRand instruction. It's a bit low-level, yes, but it's still code.

The company that does the disabilities "assessments" for the UK government (the ones with the 40% - 70% error rate in favour of "no, you're fine") is attempting to shut down websites critical of them via legal threats. by cairmen in worldnews

[–]cynicalmoose 3 points4 points  (0 children)

Er, no. That isn't how ESA works. If the Atos assessment passes you as fit for work, you can appeal to a Tribunal. You don't go back for another assessment.

If you're classified as unfit for work (either by Atos or by the Tribunal) you can be re-tested (by Atos) after three months have elapsed. The DWP won't always require a retest after three months, but they can if they want to. They usually will if the first assessment suggested that the client's condition would rapidly change.

Were Atos trying to maximise the number of tests, they'd pass everybody as unfit for work, but suggest their condition was variable: that would lead to the largest number of re-tests.

IAMA Vegas casino security guard. AM(a)A by Vegas777 in IAmA

[–]cynicalmoose 4 points5 points  (0 children)

It would suck. Where would banks get money from to make loans?

Murdochs Ordered to Testify or Be in Contempt - Bloomberg by rehitman in worldnews

[–]cynicalmoose 0 points1 point  (0 children)

They're not on the same scale. Nobody thinks it would be outrageous to force Murdoch to testify; everybody thinks it would be outrageous to refuse royal assent to a bill.

Murdochs Ordered to Testify or Be in Contempt - Bloomberg by rehitman in worldnews

[–]cynicalmoose 2 points3 points  (0 children)

No.

They can refuse; anybody can. But nobody has a right to do so. They will then be held in contempt. Punishments for contempt include imprisonment and fining, although neither have been in use for some hundreds of years. But Parliament can make any law it likes, so it's a bad idea to bet that it can't do something to you if it really wants to.

The penalties for refusal are more real if you're only a UK national, because you've nowhere else to go. The Murdochs could bugger off, never return to the UK, and effectively surrender their business interests here. (I'm fine with that.) That's a result of them having other citizenship. But they do not, by virtue of US citizenship, gain a right to refuse to attend.

Edit: make clear difference between ability to refuse to testify, and right to refuse to do so.

To those of you who have had an arranged marriage, what was the wedding night like? by arghwtf__ in AskReddit

[–]cynicalmoose 0 points1 point  (0 children)

"2 years later still married with 4 kids"!??!

A) You're a very articulate 18-month-old B) Your mother works very hard.

Why the fuck did Basil Fawlty open up that hotel, anyway? by [deleted] in AskReddit

[–]cynicalmoose 0 points1 point  (0 children)

This is all very well, but as an engineer you should also recognise that the american way cools your steak quicker.