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
export class OSVC { | |
public readonly percentageDiscount = 0.6 | |
constructor(public readonly expectedIncome: number) {} | |
get totalExpenses(): number { | |
return this.healthInsurance + this.socialInsurance + this.taxes | |
} | |
get netIncome(): number { |
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
class BinaryIntervalSearch( | |
private val initialValue: Int, | |
private val estimationStep: Int, | |
private val maxValue: Int, | |
val meetsCondition: () -> Boolean = { true } | |
) { | |
fun search(doWork: (newValue: Int) -> Unit): Int { | |
if (this.maxValue < initialValue) { | |
throw Error("Max value cant be smaller than initial value") |
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
// 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() { |
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
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 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 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 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 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 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 maccy google-chrome warp rectangle mimestream messenger github visual-studio-code jetbrains-toolbox spotify 1password keepingyouawake | |
# Docker stuff |
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
export default (prc: number) => { | |
const cols = process.stdout.columns - 7 | |
const oneBar = cols / 100 | |
let i = 0 | |
let progressBar = '[' | |
NewerOlder