(Full description and list of commands at - https://npmjs.org/doc/index.html)
Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
try: | |
from functools import wraps | |
except ImportError: | |
from django.utls.functional import wraps | |
from django.conf import settings | |
from django.contrib.auth import REDIRECT_FIELD_NAME | |
from django.http import HttpResponseForbidden, HttpResponseRedirect | |
from django.template import loader, RequestContext, TemplateDoesNotExist | |
from django.utils.decorators import available_attrs |
class CORSMiddleware(object): | |
"""Enable serving of CORS requests (http://en.wikipedia.org/wiki/Cross-origin_resource_sharing)""" | |
ALLOW_ORIGIN = "*" | |
ALLOW_HEADERS = "Origin, X-Requested-With, Content-Type" | |
def __init__(self, app): | |
self.app = app | |
def __call__(self, environ, start_response): |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
(Full description and list of commands at - https://npmjs.org/doc/index.html)
Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:
<?php | |
$root = $_SERVER['DOCUMENT_ROOT']; | |
chdir( $root ); | |
$path = '/'.ltrim( parse_url( $_SERVER['REQUEST_URI'] )['path'],'/' ); | |
if ( file_exists( $root.$path ) ) | |
{ | |
if ( is_dir( $root.$path ) && substr( $path,strlen( $path ) - 1, 1 ) !== '/' ) | |
{ |
from pyramid.view import view_config | |
from sqlalchemy.ext.associationproxy import AssociationProxy | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import scoped_session, sessionmaker, object_mapper, ColumnProperty, SynonymProperty | |
Session = scoped_session(sessionmaker()) | |
class _PrettyPrintBase(object): | |
"""Base mixin for all of our declarative tables |
type Data struct { | |
PostData url.Values | |
Errors string | |
} | |
func Handler(w http.ResponseWriter, r *http.Request) { | |
data := new(Data) | |
if r.Method == "POST" { | |
err := r.ParseForm() | |
if err != nil { |
#!/usr/bin/env python | |
import sys, os, time, atexit | |
from signal import SIGTERM | |
class Daemon: | |
""" | |
A generic daemon class. | |
Usage: subclass the Daemon class and override the run() method |
I recently had the following problem:
We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like
ssh -L 3306:localhost:3306 remotehost
package main | |
import ( | |
"crypto/tls" | |
"crypto/x509" | |
"log" | |
"net/rpc" | |
) | |
func main() { |