Quick uninstall JetBrains settings:
curl -sL https://gist.githubusercontent.com/denji/9731967/raw/jetbrains-uninstall.sh | sudo bash -s
public class HelloYaml { | |
@SuppressWarnings("unchecked") | |
public static void main(String[] args) throws FileNotFoundException { | |
Yaml yaml = new Yaml(); | |
System.out.println(yaml.dump(yaml.load(new FileInputStream(new File( | |
"hello_world.yaml"))))); | |
Map<String, Map<String, String>> values = (Map<String, Map<String, String>>) yaml | |
.load(new FileInputStream(new File("hello_world.yaml"))); |
Quick uninstall JetBrains settings:
curl -sL https://gist.githubusercontent.com/denji/9731967/raw/jetbrains-uninstall.sh | sudo bash -s
// Q sample by Jeff Cogswell | |
/*=========== | |
We want to call these three functions in sequence, one after the other: | |
First we want to call one, which initiates an ajax call. Once that ajax call | |
is complete, we want to call two. Once two's ajax call is complete, we want to call three. | |
BUT, we don't want to just call our three functions in sequence, as this quick | |
demo will show. Look at this sample function and think about what order |
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
def xpath_soup(element): | |
# type: (typing.Union[bs4.element.Tag, bs4.element.NavigableString]) -> str | |
""" | |
Generate xpath from BeautifulSoup4 element. | |
:param element: BeautifulSoup4 element. | |
:type element: bs4.element.Tag or bs4.element.NavigableString |
{0: 'tench, Tinca tinca', | |
1: 'goldfish, Carassius auratus', | |
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
3: 'tiger shark, Galeocerdo cuvieri', | |
4: 'hammerhead, hammerhead shark', | |
5: 'electric ray, crampfish, numbfish, torpedo', | |
6: 'stingray', | |
7: 'cock', | |
8: 'hen', | |
9: 'ostrich, Struthio camelus', |
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
#!/usr/bin/env python | |
import urllib, sys, bs4 | |
print bs4.BeautifulSoup(urllib.urlopen("http://data.alexa.com/data?cli=10&dat=s&url="+ sys.argv[1]).read(), "xml").find("REACH")['RANK'] |