Skip to content

Instantly share code, notes, and snippets.

View zmts's full-sized avatar
🇺🇦
russian warship go f*uck yourself

Sasha Zmts 🇺🇦 zmts

🇺🇦
russian warship go f*uck yourself
View GitHub Profile
@zmts
zmts / knex_ssl.md
Last active September 3, 2023 23:21
Can't connect to PostgreSQL. SSL error with Nodejs/Knexjs (Digital ocean)

Can't connect to PostgreSQL. SSL error with Nodejs/Knexjs (Digital ocean)

Issues:

Case 1

{
  client: 'pg',
  connection: {
    host: process.env.DB_HOST,
    port: process.env.DB_PORT,
@zmts
zmts / base64.md
Last active June 30, 2021 18:54
base64 on unix systems

base64 on Unix systems

How get base64 from any file ?

Write to output

cat var/tmp/myFile.txt | base64

Or write to file

cat var/tmp/myFile.txt | base64 > var/tmp/decodedFile.txt
@zmts
zmts / permissions.md
Last active July 24, 2020 15:31
Permissions for ssh/id_rsa

Permissions for ssh/id_rsa

Case 1

git clone [email protected]:....git

fails with:

Permissions 0644 for '/root/.ssh/id_rsa' are too open.
@zmts
zmts / pm2.md
Last active July 20, 2020 18:33
pm2
@zmts
zmts / debian_nodejs.md
Last active June 29, 2022 18:11
How To Install Node.js on Debian 10
@zmts
zmts / MANUAL.md
Created July 18, 2020 14:08 — forked from s-lyn/MANUAL.md
Deploy nodejs app with gitlab.com and pm2

Deploy nodejs app with gitlab.com and pm2

This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:

  • Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
  • Windows 10 on my PC to work.
@zmts
zmts / dockerToLocalhost.md
Created June 30, 2020 09:49
Get access to localhost database from docker container

Get access to localhost database from docker container

  • Run containerized application on 0.0.0.0 address
  • Use host.docker.internal as database hostname
@zmts
zmts / calc.md
Created June 7, 2020 09:19
Tiny Library for Basic but Precise Arithemetic
@zmts
zmts / imageSize.md
Created June 6, 2020 16:48
Get image width and height with JavaScript

Get image width and height with JavaScript

function imageSize (image) {
  return new Promise((resolve, reject) => {
    try {
      const fileReader = new FileReader()

      fileReader.onload = () => {
 const img = new Image()
@zmts
zmts / cmd.sh
Last active May 14, 2020 15:21 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 "http://example.com/api/v1/locations/"