Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
| /* | |
| * I add this to html files generated with pandoc. | |
| */ | |
| html { | |
| font-size: 100%; | |
| overflow-y: scroll; | |
| -webkit-text-size-adjust: 100%; | |
| -ms-text-size-adjust: 100%; | |
| } |
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
| -- 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%' |
| import termios | |
| import fcntl | |
| import os | |
| import struct | |
| with open(os.ctermid(), 'r') as fd: | |
| packed = fcntl.ioctl(fd, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0)) | |
| rows, cols, h_pixels, v_pixels = struct.unpack('HHHH', packed) | |
| print rows, cols, h_pixels, v_pixels |
| #!/usr/bin/env python | |
| from datetime import datetime | |
| from json import loads | |
| from time import gmtime, mktime, strptime | |
| # LevelDict é um wrapper usando dicionário para LevelDB | |
| # https://github.com/maurobaraldi/leveldict | |
| from leveldict import LevelJsonDict | |
| from requests import get |
| ====================================================== | |
| Setting up Django using Apache/mod_wsgi on Ubuntu 8.10 | |
| ====================================================== | |
| This article will cover setting up Django using Apache/mod_wsgi on Ubuntu | |
| 8.10. The article is targeted at a production environment, but keep in mind | |
| this is a more generalized environment. You may have different requirements, | |
| but this article should at least provide the stepping stones. | |
| The article will use distribution packages where nesscary. As of 8.10 the |
| import fcntl | |
| import os | |
| import struct | |
| import subprocess | |
| # Some constants used to ioctl the device file. I got them by a simple C | |
| # program. | |
| TUNSETIFF = 0x400454ca | |
| TUNSETOWNER = TUNSETIFF + 2 |
| # -*- coding: utf-8 -*- | |
| import gdata.contacts.client | |
| import gdata.contacts.data | |
| USER = "" | |
| PASSWD = "" | |
| PREFIX = '041' | |
| def add_prefix_to_contacts(gd_client, prefix): |
| # aecho.py | |
| from socket import * | |
| import asyncio | |
| loop = asyncio.get_event_loop() | |
| async def echo_server(address): | |
| sock = socket(AF_INET, SOCK_STREAM) | |
| sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) |
This is companion code to this guide.