JFS_BASE=/Users/yujunz/JuiceFS
JFS_NAME=rogerz-s3-cn-east-1-qiniu
BUNDLE=TimeMachine.sparsebundle
VOLUME=/Volumes/TimeMachine
# Mount JuiceFS
juicefs mount --cache-dir $JUICEFS_BASE/cache --batch 10 --writeback --metacache --opencache $JFS_NAME $JFS_BASE/$JFS_NAME
# Create sparse bundle
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
| import java.util.*; | |
| class Main { | |
| public static void main(String[] args) { | |
| System.out.println(modifyStr("").equals("")); | |
| System.out.println(modifyStr("Automotive parts").equals("A6e p3s")); | |
| System.out.println(modifyStr("Automotive par").equals("A6e p1r")); | |
| System.out.println(modifyStr("Automotive pa").equals("A6e p0a")); | |
| System.out.println(modifyStr("Automotive p").equals("A6e p0p")); | |
| System.out.println(modifyStr("**Automotive p").equals("**A6e p0p")); |
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 decrypt(word) { | |
| // string to char array | |
| let chars = []; | |
| for (let c of word) { | |
| chars.push(c); | |
| } | |
| // step 3 | |
| let asciiValues = chars.map(c => c.charCodeAt(0)); | |
| console.log(asciiValues); |
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 countDuplicate(arr) { | |
| let map = new Map(); | |
| arr.forEach(num => { | |
| if (map.get(num) > 0) { | |
| // set(key, value) | |
| map.set(num, map.get(num) + 1); | |
| } else { | |
| // set(key, value) | |
| map.set(num, 1); | |
| } |
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
| /* | |
| How to export | |
| * mongo is mongoshell command | |
| mongo dbname --quiet mongodbIndexExporter.js > index.js | |
| */ | |
| let collectionNames = db.getCollectionNames(); | |
| let index_data = {'collections': []}; | |
| for (let i in collectionNames) { |
OlderNewer