This file contains hidden or 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
| # Install NVM or FVM | |
| # https://github.com/nvm-sh/nvm | |
| # https://github.com/Schniz/fnm | |
| cd () { builtin cd "$@" && chpwd; } | |
| chpwd () { | |
| NVM_PATH="$PWD/.nvmrc" | |
| if test -f "$NVM_PATH"; then | |
| nvm use |
This file contains hidden or 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 { createElement, useEffect, useRef } from 'react' | |
| const RightClick = ({ as = 'div', onRightClick, children, ...rest }) => { | |
| const ref = useRef() | |
| useEffect(() => { | |
| const handler = e => { | |
| e.stopPropagation() | |
| e.preventDefault() | |
| onRightClick(e) |
This file contains hidden or 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
| export default (prc: number) => { | |
| const cols = process.stdout.columns - 7 | |
| const oneBar = cols / 100 | |
| let i = 0 | |
| let progressBar = '[' | |
This file contains hidden or 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
| # Install homebrew | |
| xcode-select --install | |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| brew install wget | |
| # Install applications | |
| brew install --casks slack maccy google-chrome warp rectangle messenger github visual-studio-code jetbrains-toolbox spotify 1password keepingyouawake | |
| # Docker stuff |
This file contains hidden or 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 kotlin.math.abs | |
| import kotlin.math.log | |
| import kotlin.math.max | |
| import kotlin.math.min | |
| /** | |
| * Shortcuts for the most common operations: | |
| * AAP = absolute atmospheric pressure | |
| * ppO2 = partial pressure of oxygen | |
| * fO2 = oxygen fraction |
This file contains hidden or 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/node | |
| const calculate = (arg) => { | |
| const o2percentage = Number(arg) | |
| const fO2 = o2percentage / 100 | |
| const mod = (ppO2) => Number((((ppO2 / fO2) - 1) * 10).toFixed(2)) | |
| console.log(`EAN${o2percentage} (content ${o2percentage}% oxygen)`) |
This file contains hidden or 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
| const geolocation = (): Promise<GeolocationPosition> => new Promise((resolve, reject) => { | |
| const geo = navigator.geolocation | |
| if (!geo) { | |
| reject('Geolocation is not supported') | |
| return | |
| } | |
| geo.getCurrentPosition( | |
| resolve, |
This file contains hidden or 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
| [core] | |
| excludesfile = ~/.gitignore | |
| [alias] | |
| co = checkout | |
| ci = commit | |
| pp = push | |
| s = status -s | |
| st = status -s | |
| df = diff --color --color-words --abbrev | |
| aa = add --all |
This file contains hidden or 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
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
| alias reload="source ~/.bash_profile && echo Bash profile reloaded" | |
| alias ll="ls -al" | |
| alias cdw="cd ~/workspace" |
This file contains hidden or 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
| // npm install ioreg --save | |
| const ioreg = require('ioreg') | |
| async function getExternalDevicesBatteryPercent() { | |
| const devices = await ioreg('AppleDeviceManagementHIDEventService') | |
| const externalDevices = devices.filter(device => !!device['BatteryPercent']) | |
| return externalDevices.map(device => ([ device['Product'], device['BatteryPercent'] ])) | |
| } | |
| async function main() { |