- Downloaded nixos-21.11/latest-nixos-gnome-x86_64-linux.iso__ from channels.nixos.org__.
- NixOS manual instructs to create the USB stick using
dd
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
import fs from "node:fs"; | |
import http from "node:http"; | |
import path from "node:path"; | |
import process from "node:process"; | |
const PORT = 8000; | |
const STATIC_PATH = path.join(process.cwd(), "./static"); | |
const NOT_FOUND_HTML_PATH = path.join(STATIC_PATH, "./404.html"); | |
const MIDDLEWARE_HANDLER = async (req, res) => { |
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
import process from "process"; | |
import chrome from 'chrome-cookies-secure'; | |
import Puppeteer from "puppeteer"; | |
const HOURLY_RATE = process.env.HOURLY_RATE || 320; | |
const DEBUG = process.env.DEBUG; | |
const CHROME_PROFILE = 'Profile 2'; // Change this to your chrome profile | |
const DEFAULT_TIMEOUT = 3000; | |
const BROWSER_HEIGHT = 800; |
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
import setup from "./setup-benchmark.js"; | |
let Benchmark = setup(); | |
Benchmark.add('RegExp#test', () => { | |
/o/.test('Hello World!'); | |
}); | |
Benchmark.add('String#indexOf', () => { | |
'Hello World!'.indexOf('o') > -1; | |
}); |
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
type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & | |
{ | |
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>; | |
}[Keys]; | |
export interface ModelRefShape { | |
id?: number; | |
uuid?: string; | |
[propName: string]: any; | |
} |
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
let stdin = process.stdin; | |
stdin.setRawMode(true); | |
stdin.resume(); | |
stdin.setEncoding('utf8'); | |
let targetInputs = {}; | |
let inputs = []; | |
stdin.on('data', function(key){ |
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
import { assert } from 'chai'; | |
import { Readable, PassThrough } from 'stream'; | |
import * as readline from 'readline'; | |
import { spawn } from 'child_process'; | |
// Adaptor for Node 10 to adapt readline streams for async iteration. | |
// (via https://medium.com/@wietsevenema/node-js-using-for-await-to-read-lines-from-a-file-ead1f4dd8c6f) | |
function readLines(input: Readable): Readable { | |
let output = new PassThrough({ objectMode: true }); | |
let lines = readline.createInterface({ input }); |
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
import Service from '@ember/service'; | |
import ENV from 'frontend/config/environment'; | |
import { getOwner } from '@ember/application'; | |
export default class DevToolService extends Service { | |
owner = getOwner(this); | |
constructor() { | |
super(...arguments); |
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
import { from, where, join, leftJoin, innerJoin } from 'memserver/query'; | |
import { cast, validat cast, validateRequired, validateFormat, validateLength, uniqueConstraint, foreignKeyConstraint } from 'memserver/changeset'; | |
let userFirstNames = User | |
|> where('u', 'u.id < 200') // 'm' because there could be multiple model references on |> sql joins() | |
|> select('u', 'u.first_name') | |
|> Repo.all | |
// or maybe some API like this as well: https://apidock.com/rails/ActiveRecord/QueryMethods/where | |
// or direct memserver like API User.findBy({}); |
NewerOlder