Open AlanGreene opened 2 years ago
detect clamshell mode (tested on macOS 12.6)
ioreg -r -k AppleClamshellState -d 1 | grep AppleClamshellState | head -n1
disable sleep on battery in clamshell mode:
pmset -g | grep hibernatemode
(record this, was 3
when I checked)
sudo pmset -a sleep 0
sudo pmset -a hibernatemode 0
sudo pmset -a disablesleep 1
revert:
sudo pmset -a sleep 1
sudo pmset -a hibernatemode <original hibernatemode value | usually 3 on a MacBook>
sudo pmset -a disablesleep 0
may only need the disablesleep
setting… (worked when testing on macOS 12.6 with 2021 16-inch M1 Max)
# Delete a given line number in the known_hosts file.
knownrm() {
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo "error: line number missing" >&2;
else
sed -i '' "$1d" ~/.ssh/known_hosts
fi
}
You can also enable remote login on the command line:
sudo systemsetup -setremotelogin on
GitHub Flavored Markdown - note / warning blocks
https://github.com/orgs/community/discussions/16925
> [!NOTE]
> Highlights information that users should take into account, even when skimming.
[!NOTE]
Highlights information that users should take into account, even when skimming.
> [!IMPORTANT]
> Crucial information necessary for users to succeed.
[!IMPORTANT]
Crucial information necessary for users to succeed.
> [!WARNING]
> Critical content demanding immediate user attention due to potential risks.
[!WARNING]
Critical content demanding immediate user attention due to potential risks.
Cypress - better CI logs
https://slides.com/bahmutov/fast-me?utm_source=substack&utm_medium=email#/20/2/0
// cypress.config.js
setupNodeEvents(on, config) {
require('cypress-mochawesome-reporter/plugin')(on)
require('cypress-terminal-report/src/installLogsPrinter')(on)
},
// spec or support file
require('cypress-mochawesome-reporter/register')
afterEach(() => {
cy.wait(50, { log: false }).then(() => {
cy.addTestContext(Cypress.TerminalReport.getLogs('txt'))
})
})
require('cypress-terminal-report/src/installLogsCollector')()
Cypress test replay
https://currents.dev/posts/currents-cypress-replay-debugger https://github.com/currents-dev/cypress-debugger
The plugin is free and open source. You can start using it today on your CI setup. When installed it will capture:
capture Cypress test execution steps capture DOM snapshots for each step capture browser console messages capture browser the networks requests (HAR)
All this information will be dumped into a file that we can then load into a web player for replaying. The player is available at https://cypress-debugger.dev/
npm scripts access to npm-specific environment variables, e.g.
$npm_new_version
fornpm version
commandhttps://www.twilio.com/blog/npm-scripts
git merge histories (e.g. importing existing projects into monorepo)