This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# All right reserved. Distributed Under BSD Lisence | |
__author__="Arun.K.R <[email protected]>" | |
__date__ ="$May 11, 2011 6:23:17 PM$" | |
import os, time | |
from random import choice | |
WIDTH = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = "Arun K Rajeevan (kra3)" | |
__copyright__ = "Copyright 2011-2012" | |
__license__ = "BSD" | |
__version__ = "2" | |
__email__ = "[email protected]" | |
__status__ = "Production" | |
import time | |
import ctypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
__author__ = "Arun KR (kra3) <[email protected]>" | |
__license__ = "Simplified BSD" | |
''' | |
Can be found at: https://gist.github.com/2409397 | |
Public Clone URL: git://gist.github.com/2409397.git | |
Private Clone URL: [email protected]:2409397.git | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install and south to your django app | |
pip install south | |
# Add south to INSTALLED_APPS list of settings.py | |
vi settings.py | |
#------------------------------------------- | |
# A syncdb will create required south tables (now on only use `migrate` command) | |
python manage.py syncdb | |
## PS: (migration) generations are kept in a `/migrate/` sub directory of apps and are simple python files. |
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object TypeclasseDemo { | |
// The parts of the type class pattern are: | |
// | |
// 1. the "type class" itself -- a trait with a single type parameter; | |
// | |
// 2. type class "instances" for each type we care about, | |
// each marked with the `implicit` keyword; | |
// | |
// 3. an "interface" to the type class -- one or more methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enable component-scanning and auto-configuration with @SpringBootApplication Annotation | |
// It combines @Configuration + @ComponentScan + @EnableAutoConfiguration | |
@SpringBootApplication | |
public class FooApplication { | |
public static void main(String[] args) { | |
// Bootstrap the application | |
SpringApplication.run(FooApplication.class, args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
from django.db import models | |
from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor # noqa | |
class RelationNotLoaded(Exception): | |
pass | |
OlderNewer