Skip to content

Instantly share code, notes, and snippets.

View tockards's full-sized avatar
💭
🍫

Toufeeq Ockards tockards

💭
🍫
View GitHub Profile
"""Simple TCP server for playing Tic-Tac-Toe game.
Use Player-to-Player game mode based on naming auth.
No thoughts about distribution or pub/sub mode
(for monitoring or something like this). Just
basic functionality.
"""
import time
import logging
import logging
import sys
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
#set streamhandler
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s -\
%(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
from __future__ import print_function
from datetime import datetime
utc_timestamp = 1428148287.0
date_object = datetime.utcfromtimestamp(utc_timestamp)
print (date_object.strftime("%Y/%m/%d %H-%M-%S"))

references

Postgresql 9.3 logging documentation a psql_logging.

To Enable Logging

@tockards
tockards / The Technical Interview Cheat Sheet.md
Last active August 29, 2015 14:28 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@tockards
tockards / container.xml
Created October 27, 2015 06:23 — forked from anqxyr/archived
Create EPUB files with Python
<?xml version='1.0' encoding='UTF-8'?>
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
<rootfiles>
<rootfile media-type="application/oebps-package+xml" full-path="content.opf"/>
</rootfiles>
</container>
@tockards
tockards / bobp-python.md
Created November 7, 2015 22:48 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@tockards
tockards / crypto-wrong-answers.md
Created November 19, 2015 07:05 — forked from paragonie-scott/crypto-wrong-answers.md
An Open Letter to Developers Everywhere (About Cryptography)
from sre_parse import Pattern, SubPattern, parse as sre_parse
from sre_compile import compile as sre_compile
from sre_constants import BRANCH, SUBPATTERN
class Scanner(object):
def __init__(self, tokens, flags=0):
subpatterns = []
pat = Pattern()
@tockards
tockards / springer-free-maths-books.md
Created December 28, 2015 20:41 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links