- Create a
Python27
app in Openshift
create a python2.7
application in openshift
if you still don't uploaded the ssh publickey to openshift, then doit:
from django.http import HttpResponseRedirect | |
from django.conf import settings | |
from re import compile | |
EXEMPT_URLS = [compile(settings.LOGIN_URL.lstrip('/'))] | |
if hasattr(settings, 'LOGIN_EXEMPT_URLS'): | |
EXEMPT_URLS += [compile(expr) for expr in settings.LOGIN_EXEMPT_URLS] | |
class LoginRequiredMiddleware: | |
""" |
<? | |
// get timestamps | |
$start = strtotime($_GET['start']); | |
$end = strtotime($_GET['end']); | |
$cb = $_GET['callback']; | |
// start data | |
echo "$cb(["; |
<!doctype html> | |
<head> | |
<title>Hi</title> | |
<style> | |
#spin { | |
background: #333; | |
color: white; | |
float: left; | |
width: 200px; | |
height: 200px; |
# -*- coding: utf-8 -*- | |
from django import forms | |
from crispy_forms.helper import FormHelper | |
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field | |
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions | |
class MessageForm(forms.Form): | |
text_input = forms.CharField() |
Python27
app in Openshiftcreate a python2.7
application in openshift
if you still don't uploaded the ssh publickey to openshift, then doit:
First, go to stackoverflow.com then define this in your Javascript console:
var hackMeSomeUnicoins = function(myFkey) {
console.log("Ok, let's hack you some shiny unicoins! <3 /dev/alias (www.devalias.net)")
console.log("The powers that be say you can only mine a rock every 10sec, so we do it every 11sec to be sure.")
window.setInterval(function(){
$.get( "http://stackoverflow.com/unicoin/rock", function( data ) {
var rockId = data.rock;
$.post( "http://stackoverflow.com/unicoin/mine?rock=" + rockId, { fkey: myFkey })
.done(function( data ) {
Much nicer solution can be used for any stackexchange sites::: First, go to stackoverflow.com(or any other stackexchange sites) then define this in your Javascript console(Press F12):
function minec(){
$.getJSON('/unicoin/rock',function(data) {
setTimeout(function(){
$.post('/unicoin/mine?rock='+data.rock,{fkey:StackExchange.options.user.fkey})
.done(function( data ) {
console.log(data);
});
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
// Open (or create) the database | |
var open = indexedDB.open("MyDatabase", 1); | |
// Create the schema | |
open.onupgradeneeded = function() { | |
var db = open.result; | |
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"}); |
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