Javascript thinks you should know to make sure you understand nodejs properly
- With functions you can do everythink you can do with other types because functions are First-Type
- Objects are a collection of name/value pairs
| import { parse, type Literal } from 'acorn'; | |
| import { type Node } from 'estree-walker'; | |
| import { walk } from 'zimmerframe'; | |
| const ast = parse(output, { | |
| ecmaVersion: 2022, | |
| sourceType: 'module', | |
| sourceFile: full_path, | |
| }); |
| """ | |
| Built on top of this gist by @karpathy: | |
| https://gist.github.com/karpathy/00103b0037c5aaea32fe1da1af553355 | |
| stable diffusion dreaming over text prompts | |
| creates hypnotic moving videos by smoothly walking randomly through the sample space | |
| example way to run this script: | |
| $ python stable_diffusion_walk.py --prompts "['blueberry spaghetti', 'strawberry spaghetti']" --seeds 243,523 --name berry_good_spaghetti |
| """ | |
| stable diffusion dreaming | |
| creates hypnotic moving videos by smoothly walking randomly through the sample space | |
| example way to run this script: | |
| $ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry | |
| to stitch together the images, e.g.: | |
| $ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4 |
| #!/bin/bash | |
| echo "Starting Windows configuration" | |
| WIN_USERPATH=$(wslpath $(wslvar USERPROFILE)) | |
| WIN_OBSIDIAN=$WIN_USERPATH/Documents/obsidian | |
| WIN_VAULTSDIR=$WIN_OBSIDIAN/vaults | |
| WSL_OBSIDIAN=~/obsidian | |
| if [ ! -d "$WIN_VAULTSDIR" ]; then |
| sudo eopkg install -y git | |
| sudo eopkg install -y atom | |
| sudo eopkg it gnome-tweak-tool | |
| apm install color-picker file-icons minimap | |
| apm install linter-csslint linter-eslint linter-js-yaml | |
| sudo eopkg it -y neofetch | |
| sudo eopkg bi --ignore-safety https://raw.githubusercontent.com/solus-project/3rd-party/master/network/web/browser/google-chrome-stable/pspec.xml | |
| sudo eopkg it -y google-chrome-*.eopkg;sudo rm google-chrome-*.eopkg |
Javascript thinks you should know to make sure you understand nodejs properly
Note: "Forked" from Latency Numbers Every Programmer Should Know
| Event | Nanoseconds | Microseconds | Milliseconds | Comparison |
|---|---|---|---|---|
| L1 cache reference | 0.5 | - | - | - |
| Branch mispredict | 5.0 | - | - | - |
| L2 cache reference | 7.0 | - | - | 14x L1 cache |
| Mutex lock/unlock | 25.0 | - | - | - |
| function makeObjectIterable (foo) { | |
| foo[Symbol.iterator] = function* () { | |
| yield* Object.keys(foo).map(function (name) { | |
| return [name, foo[name]] | |
| }) | |
| } | |
| return foo | |
| } | |
| let moment = require('moment'); | |
| let cheerio = require('cheerio'); | |
| let async = require('asyncawait/async'); | |
| let await = require('asyncawait/await'); | |
| let rp = require('request-promise'); | |
| const URL = 'https://npm.cpami.gov.tw/bed_1.aspx'; | |
| const getASPState = () => { | |
| return new Promise( (resolve, reject) => { |
| function byteArrayToWordArray(ba) { | |
| var wa = [], | |
| i; | |
| for (i = 0; i < ba.length; i++) { | |
| wa[(i / 4) | 0] |= ba[i] << (24 - 8 * i); | |
| } | |
| return CryptoJS.lib.WordArray.create(wa, ba.length); | |
| } |