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
| REM For git binary we can use windows bash.exe because git is installed in wsl in binary path | |
| REM For other tools which are included as functions or in interactive shell like nvm (nvm, node, npm) we need to run debian (or other distributive) | |
| REM Binary version | |
| @echo off | |
| If %PROCESSOR_ARCHITECTURE% == x86 ( | |
| "C:\Windows\sysnative\bash.exe" -c "git %*" | |
| ) Else ( | |
| "bash.exe" -c "git %*" | |
| ) |
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
| # Pass the env-vars to MYCOMMAND | |
| eval $(egrep -v '^#' .env | xargs) MYCOMMAND | |
| # … or ... | |
| # Export the vars in .env into your shell: | |
| export $(egrep -v '^#' .env | xargs) |
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
| #!/usr/bin/env node | |
| 'use strict'; | |
| const { createServer, connect } = require('net'); | |
| const log = (group) => (...args) => console.log.apply(console, ['[' + group + ']', ...args]); | |
| const err = (group) => (...args) => console.error.apply(console, ['[' + group + ']', ...args]); | |
| const l = log('server'); |
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
| function parseSize(size, power) { | |
| power = power || 1024; | |
| var pref = ['b', 'K', 'M', 'G', 'T'], sizes = [], i = 0; | |
| while (size > 1) { | |
| sizes.unshift((size % power) + pref[i]); | |
| size = Math.floor(size / power); | |
| i++; | |
| } | |
| return sizes.join(' '); |
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
| var string = ''; | |
| var chars = [[48, 57], [65, 90], [97, 122]]; | |
| chars.forEach(function (charRange) { | |
| for (var i = charRange[0]; i<=charRange[1]; i++) { | |
| string += String.fromCharCode(i); | |
| } | |
| }); |
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
| function generateRandom(n) { | |
| return Math.floor(Math.random() * Math.pow(16777215, n || 2)).toString(36); | |
| } |
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
| // File: get_language.js | |
| /** | |
| * Parses header 'Accept-Language' and returns array with extracted languages | |
| * sorted by quality factor. | |
| * | |
| * @param header | |
| * @returns {Array} | |
| */ |