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
#!/usr/bin/env python2.7 | |
import random | |
import numpy | |
def gen_random_string(range_start, range_end, str_len): | |
#~.145 s | |
return "".join( | |
[ | |
"x%04x" %\ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1/scriptaculous.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> |
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
'use strict'; | |
/** Function to flatten sub-arrays within an array into one big array. | |
* @param {Array} origArray - The array to flatten. | |
* | |
* @returns {Array} The flattened array. | |
*/ | |
function flatten(origArray) { | |
var flattenedArray = []; |
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
v6.9.2 | |
3.10.9 | |
[email protected] /Users/colbyblair/code/communityco/svc-qa | |
├─┬ @communityco/[email protected] | |
│ └─┬ [email protected] | |
│ ├── [email protected] | |
│ ├── [email protected] | |
│ ├── [email protected] | |
│ └─┬ [email protected] | |
│ ├── [email protected] |
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
#!/usr/bin/env node | |
const fs = require('fs'); | |
const bumpVersion = process.argv.length >= 3 ? process.argv[2] : undefined; | |
['./package.json', './package-lock.json'].forEach(fname => { | |
let packageJson = fs.readFileSync(fname, 'utf8'); | |
const [full, semver] = packageJson.match('"version":[ ]*"([0-9]+\.[0-9]+\.[0-9]+)"'); | |
let [major, minor, patch] = semver.split('.').map(version => parseInt(version)); |
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 express = require('express'); | |
const app = express(); | |
const port = 4000; | |
// Payments | |
// In the real world, we would use a real database like Postgres or MongoDB. Just in memory for the sake of this example. | |
const payments = {}; | |
/** POST /payment - Create a payment. |
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
// WIP | |
// Objective: Create a Node.js script that encrypts text files within a specified directory using asynchronous programming. This script should encrypt the content of each text file using a basic Caesar Cipher for simplicity, then save the encrypted content to a new file in a different directory. The process should handle multiple files concurrently, support both encryption and decryption modes, and log the completion of each file operation. | |
// Requirements: | |
// Mode Selection: The script should accept a mode argument (encrypt or decrypt) as the first command-line argument to determine the operation mode. | |
// Directory Arguments: Accept two additional command-line arguments for the input directory (containing text files to process) and the output directory (where encrypted or decrypted files will be saved). | |
const { assert } = require("node:console"); | |
const { argv } = require("node:process"); | |
const { readdir, readFile } = require('node:fs/promises'); |