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 fs = require('fs') | |
| const path = require('path') | |
| const os = require('os') | |
| const d = path.join(os.homedir(), PICK_YOUR_CLAUDE_CODE_DIRECTORY) | |
| const objects = fs.readdirSync(d).map(at => path.join(d, at)).filter(at => at.endsWith('.jsonl')).flatMap(at => { | |
| return fs.readFileSync(at, 'utf-8').split('\n').flatMap((line, i) => { | |
| if (!line.trim()) { | |
| return [] |
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
| BLUE="\[\033[01;34m\]" | |
| ~/code/sample-monorepo$ WHITE="\[\033[01;00m\]" | |
| ~/code/sample-monorepo$ PS1="${debian_chroot:+($debian_chroot)}$BLUE\w\$ $WHITE" |
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('crypto').publicEncrypt("-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxm6YetHJ5gdhv7TmD9uD\nl4XErogLhypON/Hi0Qvsy3QVXukbziVKBB4pgtNU303NMTVYuakUpYuyVuOiwaTv\nXVf8gyB6MzhbaUpVkPQimbt24kAXVmIUAA/7Hg6QqfssBFfwB+vBmPPzoZflHz1M\n+sx6pdyKwM1hK41evnTzjfY11Xhc3RmmLtPxWOSF2oR+hZ2lCtDgc5CKWQ5f5ade\n4s3RNiIKaV8U0oR4SKf1ty0PSW7/C+RPO2b7NlHKurLDIsCmTjxOkyYboQlJhH3W\nevjHrDF9Oli2mRsHPMidjkTgdjdugwda38rNS6ZvFbhNWd55HtRNCxjblFhIbs0X\nln/I86fbhOPNBt3VKBhE2lV6cgFg76JI7vS12uiQmtdj1RixulrgH8xrD+gpyyoi\nORgAYtflgr1DRHFerBqGCzds/bbR6FG/Luy3yK2zzBDVPRbM4hks3/sAZf3LVtED\nWDRB9E+Vb8SRWytidkp33l5d+2V03EE4+WalpG9FRVJCFQYSXd/ebT1qVfZMECZB\nsNrZxuznBOl8cPYA2Tros/k9hE10xCDMZbWi0Q4IKqgmCW7z9HR+D22HPwyXRsVH\nK1jyT8/1r7Qg6eEHDaGWYP5QbdrXxFUx6kFSBsglKajjaQO06VGb4XnBBArDG9Hp\nV8g3LLykdaFU592oN57DkfcCAwEAAQ==\n-----END PUBLIC KEY-----\n", Buffer.from('plain-text')).toString('hex') |
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 keys = {} | |
| crypto.generateKeyPair('rsa', { | |
| modulusLength: 4096, | |
| publicKeyEncoding: { | |
| type: 'spki', | |
| format: 'pem' | |
| }, | |
| privateKeyEncoding: { | |
| type: 'pkcs8', | |
| format: 'pem', |
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
| // with .resolves | |
| expect(received).resolves.toBeDefined() | |
| Received promise rejected instead of resolved | |
| Rejected to value: [RequestError: Invalid authorization token provided: Bearer 0a933cd4bceffa68993ca34d58f31684d0923d31] | |
| 50 | }) | |
| 51 | | |
| > 52 | await expect(driver.runPr()).resolves.toBeDefined() |
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 https = require('https'); | |
| const child_process = require('child_process') | |
| const JSON5 = require('json5') | |
| const argv = process.argv.slice(2).map(x => x.trim()).filter(Boolean) | |
| if (argv.length !== 3) { | |
| console.log(`Usage: ${process.argv[1]} <groupId>:<artifactId> <GRPC-method> <payload>`) | |
| process.exit(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
| const fs = require('fs') | |
| const path = require('path') | |
| const dirs = [ | |
| 'src/misc', | |
| 'src/cimonorepo', | |
| 'src/fingerprinting', | |
| 'src/graphs', | |
| '__tests__/unit-tests/misc', | |
| '__tests__/unit-tests/cimonorepo', |
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
| _ "tiny insignifcant changes" | |
| _1 "dead code removal" | |
| _2 "followups of the previous commit, trying to make it work" | |
| _3 "refactoring" |
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
| _ "tiny insignifcant changes" | |
| _1 "dead code removal" | |
| _2 "followups of the previous commit, trying to make it work" |
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
| So a common conception (perhaps I should say “misconception”) about Exceptions in Scala is that they should be avoided due to lack of referential transparency (see “do not throw exceptions” and “referential transparency”). I think this topic is a bit subtler that one might initially think. | |
| The argument goes as follows: “you should be able to inline/extract variables without changing the program’s behavior. But Exceptions are not like that.” | |
| The text-book example goes as follows: | |
| def f1(n: Int): Int = | |
| if (n == 0) throw new RuntimeException("zero") else n + 1 | |
| def f2(n: Int): Int = { | |
| val x = throw new RuntimeException("zero"); | |
| if (n == 0) x else n + 1 | |
| } | |
| The only difference between these two functions is that the throw expression was extracted into a variable. However, the two functions are not equivalent (f1(4) succeeds but f2(4) fails), hence … “exceptions should be avoided”. |
NewerOlder