uuid() {
uuidgen | tr -d '\n' | pbcopy
}
rand() {
As posted on: https://timvisee.com/blog/list-export-your-subreddits/
To obtain a list of your subreddits, do the following:
Enter
.javascript:
is included at the beginning, your browser might remove it while copy-pasting for security reasons:
We're going to parse a file, use a conditional to add a new column, then save the new file with an additional column all without using any external dependencies not included in the standard lib
const fs = require('fs');
const inputCsvFile = 'input.csv';
const outputCsvFile = 'output.csv';
This is a working example of symmetric encryption in nodejs.
From https://stackoverflow.com/questions/41043878/symmetric-encryption-with-nodejs
var assert = require('assert');
var crypto = require('crypto');
const fs = require('fs')
import never from 'never' | |
type ParsedLogs = Array<[string, string]> | |
type GroupedLogs = { | |
[K: string]: Array<string> | |
} | |
export default function main(logs: string) { | |
const parsedLogs = parseAndNormaliseLogs(logs) |
function parseLogs(logs) { | |
const logsArray = logs.split('\n').map(eachLog => eachLog.split(',')) | |
const normalisedArray = normaliseArray(logsArray) | |
const logsWithSeconds = normalisedArray.map(([timestamp, phoneNumber]) => | |
[calculateTotalSeconds(timestamp), phoneNumber]) | |
const grouped = groupByPhoneNumber(logsWithSeconds) | |
const phoneNumberWithLargestTotal = getPhoneNumberWithLargestTotalSeconds(grouped) | |
grouped[phoneNumberWithLargestTotal] = 0 | |
return calculateTotalBill(logsWithSeconds, phoneNumberWithLargestTotal) | |
} |
const crypto = require('crypto') | |
const fs = require('fs') | |
const encryptedData = fs.readFileSync('encrypted_data.txt', { encoding: 'utf-8' }) | |
const privateKey = fs.readFileSync('private.pem', { encoding: 'utf-8' }) | |
const decryptedData = crypto.privateDecrypt( | |
{ | |
key: privateKey, | |
// In order to decrypt the data, we need to specify the |
const fs = require('fs') | |
const crypto = require('crypto') | |
const dataToEncrypt = fs.readFileSync('data_to_encrypt.txt', { encoding: 'utf-8' }) | |
const publicKey = Buffer.from(fs.readFileSync('public.pem', { encoding: 'utf-8' })) | |
const encryptedData = crypto.publicEncrypt( | |
{ | |
key: publicKey, |
const crypto = require('crypto') | |
const fs = require('fs') | |
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", { | |
// The standard secure default length for RSA keys is 2048 bits | |
modulusLength: 2048, | |
}) | |
// ********************************************************************* | |
// |