COPY can read/write data not only from/to CSV, but also from/to binary files. For the import, the table must exist along with its columns matching CSV columns.
COPY <table> TO 'file.csv' DELIMITER ',' CSV HEADER; | FILES=*.rst | |
| for f in $FILES | |
| do | |
| filename="${f%.*}" | |
| echo "Converting $f to $filename.md" | |
| `pandoc $f -f rst -t markdown -o $filename.md` | |
| done |
| Bank Name | SWIFT/BIC Code |
|---|---|
| ALIOR BANK | ALBPPLPW |
| ALIOR Sync | ALBPPLPW |
| ABN AMRO BANK | ABNAPLPW |
| ALLIANZ BANK | ALLBPLPW |
| CREDIT AGRICOLE | AGRIPLPR |
| BANK POLSKIEJ SPÓŁDZIELCZOŚCI | POLUPLPR |
| BPH | BPHKPLPK |
| BGŻ (Bank Gospodarki Żywnościowej) | GOPZPLPW |
Blog post: https://zaiste.net/nodejs-child-process-spawn-exec-fork-async-await/
Node.js runs in a single thread. You can, however take advantage of multiple processes.
child_process module allows to create child processes in Node.js. Those
processes can easily communicate with each other using a built-in messaging system.
| #!/bin/bash | |
| set -e | |
| mkdir -p $HOME/bin $HOME/src | |
| cd $HOME/src | |
| wget https://github.com/tmux/tmux/releases/download/2.6/tmux-2.6.tar.gz | |
| wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz | |
| wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz |
| const { compile } = require('pure-engine') | |
| const escape = require('escape-html') | |
| const fs = require('fs-extra'); | |
| async function example() { | |
| const content = await fs.readFile('./index.html'); | |
| const { template } = await compile(content.toString()) | |
| console.log(template({ foo: 'bar' }, escape)) | |
| } |
| class String | |
| def unindent | |
| gsub(/^#{scan(/^\s*/).min_by{|l|l.length}}/, "") | |
| end | |
| end | |
| def display | |
| text = <<-TEXT.unindent | |
| Lorem ipsum dolor sit amet, | |
| consectetur adipisicing elit, |
Before we go on creating an actual RESTful API, let's address the elephant in the room: how to make an HTTP endpoint sufficiently secure in Node.js ?
I say sufficiently because, the topic of security is broad and constantly evolves. This article is a response to other Node.js articles I've seen that contain security mistakes. It may not be perfect, either, but is hopefully a good evolution on the topic.
Check the full article.
| Version | URL | Req/s Avg | Req/s Max | Req/s Total | Latency Avg | Latency Max | |||
|---|---|---|---|---|---|---|---|---|---|
| Node.js Bare | 11.14.0 | 2180 | 3410 | 54257 | 8.49 | 1.84 | 6.49 | ||
| Fastify | 2.3.0 | 2170 | 5240 | 54068 | 8.46 | 1.85 | 5.63 | ||
| Szelmostwo (Huncwot's Core) | 0.5.1 | 3440 | 5460 | 85482 | 8.80 | 1.17 | 3.55 | ||
| Huncwot | 0.40.0 | https://huncwot.org/ | 3430 | 6020 | 85167 | 8.77 | 1.17 | 3.48 | |
| uWebSockets | 15.10.0 | 6840 | 7180 | 170266 | 19.97 | 0.58 | 1.53 | ||
| Trek Router | 0.0.1 | 1760 | 3120 | 43777 | 6.22 | 2.28 | 6.81 | ||
| Kemal | 3750 | 30940 | 93217 | 11.82 | 1.07 | 2.07 | |||
| Turbo HTTP | 0.3.2 | 3220 | 5700 | 80123 | 9.70 | 1.25 | 3.46 |
| const Szelmostwo = require('./'); | |
| const { ok, json, created } = require('./response'); | |
| const { serve, security } = require('./middleware'); | |
| const app = new Szelmostwo(); | |
| app.get( | |
| '/', | |
| security(), |