Skip to content

Instantly share code, notes, and snippets.

View alazycoder101's full-sized avatar

Lazy coder alazycoder101

View GitHub Profile
@alazycoder101
alazycoder101 / git-stash.md
Last active November 28, 2022 18:53
git-stash.md
# stash untracked ones
git stash -u
git stash --include-untracked

# stash all
git stash -a
git stash --all

# interactive

How to seup multiple accounts on Github

I have two GitHub accounts one for personal project and one for company. I used create two accounts on the Macbook to swith between them. Then I found out some way to setup automatically under same account and switch smoothly between them without any fuss at all.

Authentication

Set up keys to connect to github for both personal and comany

ssh-keygen -t rsa -b 4096 -f dev -C dev@mail.com
ssh-keygen -t rsa -b 4096 -f company -C staff@company.com

Upgrate PostgreSQL to 15

To upgrade PostgreSQL there are three ways

  1. dump and restore utility.
  2. pg_upgrade utility.
  3. with logical replica

pg_dump and pg_restore

  • dump global

Error: profiles: There are profiles installed that marked non-removable

Goto Recovery Mode

  • Turn off your Mac.
  • Press and hold the Power button.
  • A message stating you'll be able to access startup options soon will appear. Keep holding the button down.
  • Click Options > Continue to open up Recovery.

Remove Profiles

  • Open Utilities -> Terminal

How to import your emails for backup

If both of the emails are gmail it's much simpler you can just

On your old email

  1. Settings -> See all settings
  2. Go to Tab of Forwarding and POP/IMAP
  3. tick Enable POP for all mail
  4. Click Save changes

Screenshot 2022-11-17 at 09 14 46

@alazycoder101
alazycoder101 / coc-vim.md
Last active November 5, 2022 16:53
Fix coc problem: out of memory
Messages maintainer: Bram Moolenaar <Bram@vim.org>
[coc.nvim]: <--- Last few GCs --->
[coc.nvim]: [32488:0x158008000]      103 ms: Scavenge 21.3 (32.1) -> 18.2 (33.4) MB, 0.5 / 0.0 ms  (average mu = 1.000, current mu = 1.000) task 
[coc.nvim]: [32488:0x158008000]      115 ms: Mark-sweep 19.1 (33.4) -> 16.7 (35.5) MB, 1.0 / 0.0 ms  (+ 0.5 ms in 12 steps since start of marking, biggest step 0.1 ms, walltime since start of marking 12 ms) (average mu = 1.000, current mu = 1.000) finalize incrementa
[coc.nvim]: <--- JS stacktrace --->
[coc.nvim]: FATAL ERROR: wasm code commit Allocation failed - process out of memory
[coc.nvim]:  1: 0x10410fed0 node::Abort() [/Users/coder/.asdf/installs/nodejs/14.15.4/bin/node]
[coc.nvim]:  2: 0x104110034 node::OnFatalError(char const*, char const*) [/Users/coder/.asdf/installs/nodejs/14.15.4/bin/node]
git log --pretty=tformat:'%H %s' -n 10 | git name-rev --stdin

git name-rev --name-only 15111bb6b
remotes/origin/main

git name-rev --name-only HEAD
remotes/origin/main

Plugins

nodejs

asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git

ruby

ArgumentError: string contains null byte

postgres=# SELECT convert_from('foo\000bar'::bytea, 'unicode');
ERROR:  22021: invalid byte sequence for encoding "UTF8": 0x00

Reference

ruby/3.1.2/lib/ruby/gems/3.1.0/gems/pg-1.4.3/lib/pg.rb:49:in `require': ruby/3.1.2/lib/ruby/gems/3.1.0/gems/pg-1.4.3/lib/pg_ext.bundle, 0x0009): Library not loaded: '/opt/homebrew/opt/postgresql/lib/libpq.5.dylib' (LoadError)
  Referenced from: 'ruby/3.1.2/lib/ruby/gems/3.1.0/gems/pg-1.4.3/lib/pg_ext.bundle'

copy the file to the referred place to solve the problem

/opt/homebrew/opt/postgresql/lib/libpq.5.dylib is changed to /opt/homebrew/opt/postgresql/lib/postgresql14@/libpq.5.dylib