Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
-- 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%' |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
#!/bin/bash | |
# (optional) You might need to set your PATH variable at the top here | |
# depending on how you run this script | |
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
# Hosted Zone ID e.g. BJBK35SKMM9OE | |
ZONEID="enter zone id here" | |
# The CNAME you want to update e.g. hello.example.com |
class chain: | |
""" | |
A class that allows the chaining of function/method calls on objects | |
and modules. | |
To use create chain an object and then go crazy calling methods one | |
after the other. | |
>>> import curses |
// Thanks @trusktr | |
var requestSync = Meteor.wrapAsync(function(url, callback) { | |
request(url, function(error, response, body) { | |
callback(error, {response: response, body: body}) | |
}) | |
}); | |
var result = requestSync("http://google.com"); | |
console.log(result.response, result.body); |
# The initial version | |
if [ ! -f .env ] | |
then | |
export $(cat .env | xargs) | |
fi | |
# My favorite from the comments. Thanks @richarddewit & others! | |
set -a && source .env && set +a |
import asyncio | |
import pathlib | |
import socket | |
import ssl | |
import pytest | |
import aiohttp | |
from aiohttp import web | |
from aiohttp.resolver import DefaultResolver |
import asyncio | |
import pathlib | |
import socket | |
import ssl | |
import pytest | |
import aiohttp | |
from aiohttp import web | |
from aiohttp.resolver import DefaultResolver |
CREATE EXTENSION IF NOT EXISTS "unaccent"; | |
CREATE OR REPLACE FUNCTION slugify("value" TEXT) | |
RETURNS TEXT AS $$ | |
-- removes accents (diacritic signs) from a given string -- | |
WITH "unaccented" AS ( | |
SELECT unaccent("value") AS "value" | |
), | |
-- lowercases the string | |
"lowercase" AS ( |
#!/bin/bash | |
RANCHERENDPOINT=https://your_rancher_endpoint/v3 | |
# The name of the cluster where the user needs to be added | |
CLUSTERNAME=your_cluster_name | |
# Username, password and realname of the user | |
USERNAME=username | |
PASSWORD=password | |
REALNAME=myrealname | |
# Role of the user | |
GLOBALROLE=user |