$ brew install postgresql@16 $ brew services start postgresql@16
- Stop PostgreSQL
brew services stop postgresql@16
- Delete the postmaster.pid
| /** | |
| * This script is used to run measurements on CodeSignal https://app.codesignal.com | |
| * to use it simply open the dev tools, and paste in the console, | |
| * it will automate the browser for you to run the tests and measure the times it took. | |
| * be patient, there are measurements to prevent blocking from CodeSignal, | |
| * and this script just automates the browser which means it cannot run tests in parallel | |
| * so the tests will take a while, just run this and go grab a coffee. | |
| * | |
| * !!!CAUTION!!! this isn't an official script and might get you banned from CodeSignal | |
| * even though there are measurements to try and prevent this, use caution. |
| Adb shell # get into the phone's shell | |
| > pm list packages # get the list of packages, skip if you know the package name | |
| > pidof -s <package-name> # get the process ID of the package | |
| > exit # exit the shell and go back to the pc shell | |
| adb logcat --pid=<pid> # log only from a specific process ID |
| // if you want a demo, just throw it in the console | |
| // it won't work in github's console since they use {"connect-src": "self"} header, you can however do it in google.com | |
| // or almost any other website | |
| // | |
| // yandex translation api is free for up to 1 million characters a day 🤩 | |
| // you can set up a free key here: https://tech.yandex.com/translate/ | |
| // or just use this, since it's from a fake account it might get blocked in the near future | |
| const KEY = 'trnsl.1.1.20190308T095934Z.95ae5cf4e28588ea.9d108fb6e768af347464925e4e98b91edb0013f5'; | |
| const FROM = 'nl'; // default source language | |
| const TO = 'en'; // default target language |
| // a simple utility function for normalizing return values | |
| const returnValue = values => values.length === 1 ? values[0] : values;; | |
| // a simple function to check existence | |
| const exists = value => value !== undefined && value !== null; | |
| const isString = value => typeof value === 'string'; | |
| const isArray = value => Array.isArray(value); | |
| // This is the actual class to hold all of our classes | |
| class ElementAbstraction { | |
| constructor(htmlElements) { |
| // Let's check if the browser supports notifications | |
| if (!("Notification" in window)) { | |
| alert("This browser does not support desktop notification"); | |
| } | |
| function notify() { | |
| new Notification("Hello world!"); | |
| } | |
| // Let's check whether notification permissions have already been granted |
| // the example: | |
| if('indexedDB' in window) { | |
| // open the database | |
| openDB(window.indexedDB, 'todos-db') | |
| // add some todos | |
| .then(({ db }) => addTodo(db, 'my todo text 1')) | |
| .then(({ db }) => addTodo(db, 'my todo text 2')) | |
| // get all the todos | |
| .then(({ db }) => getTodos(db)) | |
| .then(({ db, event }) => { |
| const { Worker } = require("worker_threads"); | |
| const path = require("path"); | |
| const os = require("os"); | |
| const ora = require("ora"); | |
| // this is how we can get the count of cpu's the computer has, | |
| // using a larger number may result in the app crushing | |
| const cpuCount = os.cpus().length; | |
| // create some big array |
| const { parentPort, workerData, isMainThread } = require("worker_threads"); | |
| // CPU consuming function (sorting a big array) | |
| function sortBigArray(bigArray) { | |
| return bigArray.sort((a, b) => a - b); | |
| } | |
| // check that the sorter was called as a worker thread | |
| if (!isMainThread) { | |
| // make sure we got an array of data |