Skip to content

Instantly share code, notes, and snippets.

View jennyluciav's full-sized avatar
😼

Jenny Vega jennyluciav

😼
View GitHub Profile
function generateSolution(solution,position) {
if (solution[position] == 'V'){
solution[position] = 'M';
} else {
solution[position] = 'V';
}
console.log("Setting in "+position+": "+solution[position]);
}
function isUnsatified (solution,customer) {
@jennyluciav
jennyluciav / psql-error-fix.md
Created November 25, 2020 15:09 — forked from AtulKsol/psql-error-fix.md
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

@jennyluciav
jennyluciav / all_aws_lambda_modules.txt
Created August 3, 2018 20:31 — forked from gene1wood/all_aws_lambda_modules_python.md
AWS Lambda function to list all available Python modules and post the list to Pastebin
# module list (generated by listmodules.py)
#
# timestamp='20160226T200954Z'
# sys.version='2.7.10 (default, Dec 8 2015, 18:25:23) \n[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]'
# sys.platform='linux2'
# platform='Linux-4.1.13-19.31.amzn1.x86_64-x86_64-with-glibc2.2.5'
#
BaseHTTPServer
Bastion
CDROM
/*
An anagram is a word that is formed by rearranging the letters of a word so as to produce a new word wich uses all the original letters exactly once.
For example, the word 'anagram' can be rearranged into 'maranag'.
Given two strings haystack and needle that contains ASCII characters, write an algorithm to output a list of 0-based indices of the occurrences of all anagrams of needle in haystack.
Input
The input to the function/method consists of two arguments-haystack,representing the second string.
Output
Retunr a list of integers representing the indices of the occurrences of all anagrams of needle in haystack.
Note
All character comparisons should be case sensitive.
/*Edward is organizing a meeting and has to order lunch for everyone in the team. To make his task simpler he has prepared two lists.
The first list has pairs of team members and their preferred cuisine types. Each team member either has a preference for a particular
cuisine or does not have any particular preference and likes all cuisines. The second one contains a list of lunch options along with
the cuisine type to which it belongs. Each lunch option belongs to only one cuisine type.
Write an algorithm that outputs a list of all possible pairs of team members along with lunch option they would enjoy. There can be no,
one or more entries for a team member in the output list depending on how many lunch options satisfy their choice of cuisine(s).
Input:
The input to the function/method consists of four arguments – lunchMenuPairs, representing a list containing pairs of lunch option and its associated cuisine type; teamCuisinePreference, representing a list containing pairs of team members and their cuisi