Skip to content

Instantly share code, notes, and snippets.

View vwedesam's full-sized avatar

Eshemiedomi Samuel Oghenevwede vwedesam

View GitHub Profile
@vwedesam
vwedesam / readme.md
Created June 23, 2024 15:11
Ubuntu - E: Unable to locate package php8.0; E: Couldn't find any package by glob 'php8.0'

On Ubuntu

E: Unable to locate package php8.0

E: Couldn't find any package by glob 'php8.0'

  sudo apt update && apt install -y software-properties-common
 sudo add-apt-repository ppa:ondrej/php
@vwedesam
vwedesam / pg: Fixed Permission Denied error for DB users.md
Created May 15, 2024 17:19
pg: Fixed Permission Denied error for DB users

Postgresql: Fixed Permission Denied error

You've granted CREATE, CONNECT, SELECT, INSERT and TEMPORARY privileges on the database to myuser You'll need something like:

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO myuser;

In addition you need privileges on sequences if you have any serial columns or other column defaults drawing from sequences.

@vwedesam
vwedesam / readme.md
Created April 4, 2024 12:06
Use Multiple ssh for different host

when you have id_rsa and id_rsa_2 in .ssh folder

Host           gitlab.com
HostName       gitlab.com
IdentityFile C:\Users\\.ssh\id_rsa
@vwedesam
vwedesam / Python fix Error: pg_config executable not found.md
Created June 29, 2023 15:07
Python fix Error: pg_config executable not found

Python fix Error: pg_config executable not found

This error happens whenver you're trying to install a package that relies on postgres executable file

Solution

Add postgres to path

for Mac OS

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions//bin

@vwedesam
vwedesam / Readme.md
Last active May 9, 2023 10:40
Update Local git repository remote origin -> reconfiguration

Let say you move a repo to a new organization, or to a new VCS

The solution is to change the address of the remote, to the correct/new remote location.

Solution 1

run this command

 git config remote.origin.url git@server.com:username/repo-name.git
@vwedesam
vwedesam / SQL Re-Use alias named columns.md
Last active April 27, 2023 17:44
SQL Re-Use alias named columns

SQL Re-Use alias named columns

USE named alias in SQL statement

You can't do it directly - you need to use something like a CTE (Common Table Expression)

E.g

SQL Calculate sum of two alias named columns

@vwedesam
vwedesam / Remove duplicates in an array(JS).md
Last active July 4, 2023 10:57
remove duplicates in an array(JS)

remove duplicate in an array, string, object, number

works for string, object, number and all data type supported in Javascript

function removeDuplicates(arr) {
    let _arr = []
    return arr.filter((item, index) => {
        _arr.push(JSON.stringify(item))
        return _arr.indexOf(JSON.stringify(item)) == index
 });
@vwedesam
vwedesam / PostgreSQL Regex match numeric(interger and demical).md
Last active April 27, 2023 17:47
PostgreSQL Regex match numeric(interger and demical)

The problem here is the two 0 or more [0-9] elements on each side of the decimal point.

we need to use a logical OR | in the number identification line:

E.g

  0.00434, 0.233220, 4.909, 0.0000003333

Solution

@vwedesam
vwedesam / Install disbaled PHP version on mac-os.md
Last active April 27, 2023 17:47
Install disbaled PHP version on mac-os

Install disbaled PHP version on Mac OS

Error: php@7... has been disabled because it is a versioned formula!

METHODS

Method 1

You can only install supported versions of PHP with brew. However, there is the tap shivammathur/php which can be used to install unsupported version of PHP.

@vwedesam
vwedesam / ts_string_to_boolean.js
Created February 27, 2023 16:03
Convert Strings to Booleans in TypeScript
/**
* 1. JSON.parse
*
*/
const booleanTrue: boolean = JSON.parse('true') // Returns true
const booleanFalse: boolean = JSON.parse('false') // Returns false
/**
* 2. helper function that checks Truthiness