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
| // days between | |
| (b - a) / (1000 * 60 * 60 * 24) | |
| // minutes between | |
| (b - a) / 60000 | |
| // seconds between | |
| (b - a) / 1000 |
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
| { | |
| "MP_Abandoned": "Zavod 311", | |
| "MP_Damage": "Lancang Dam", | |
| "MP_Flooded": "Flood Zone", | |
| "MP_Journey": "Golmud Railway", | |
| "MP_Naval": "Paracel Storm", | |
| "MP_Prison": "Operation Locker", | |
| "MP_Resort": "Hainan Resort", | |
| "MP_Siege": "Siege of Shanghai", | |
| "MP_TheDish": "Rogue Transmission", |
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/bash | |
| S1='whatismyip.akamai.com' | |
| S2='icanhazip.com' | |
| S3='ifconfig.me' | |
| IP=$(curl -sk $S1) | |
| IP_regex='^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' | |
| if [[ ! $IP =~ $IP_regex ]]; then |
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
| clear; con_logfile cvarlist.txt; cvarlist; con_logfile end |
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 request = function(url) { | |
| return new Promise((resolve, reject) => { | |
| const lib = url.startsWith('https') ? require('https') : require('http'); | |
| const request = lib.get(url, (response) => { | |
| if (response.statusCode < 200 || response.statusCode > 299) { | |
| reject(new Error('Failed to load page, status code: ' + response.statusCode)); | |
| } | |
| const body = []; | |
| response.on('data', (chunk) => body.push(chunk)); | |
| response.on('end', () => resolve(body.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
| #!/bin/bash | |
| TOTAL=$(curl -s "https://www.raspberrypi.org/magpi-issues/" | grep -Eo "\"MagPi[0-9]+.pdf" | wc -l) | |
| for issue in $(eval echo {01..$TOTAL}); do | |
| [ ! -f "MagPi$issue.pdf" ] && curl -Os "https://www.raspberrypi.org/magpi-issues/MagPi$issue.pdf" | |
| done |
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 puppeteer = require('puppeteer'); | |
| (async () => { | |
| const browser = await puppeteer.launch({headless: true}) | |
| var pages = await browser.pages() | |
| var page = pages[0] | |
| await page.goto('') |
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/bash | |
| dir="$(dirname "$(realpath "$0")")" | |
| log="$( | |
| date | |
| sudo apt-get -y update | |
| sudo apt-get -y upgrade | |
| sudo rpi-update | |
| sudo apt-get autoremove |
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
| require('http') | |
| .createServer() | |
| .listen({ | |
| port: 4000 | |
| }) | |
| .on('request', (req, res) => { | |
| res.end('Hello World!'); | |
| }); |
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
| let a = {}; | |
| Object.keys(b).sort().forEach(key => { | |
| a[key] = b[key]; | |
| }); |