Skip to content

Instantly share code, notes, and snippets.

0xDb49F1895F1b2232194cC2aa30dF68956389E60d
9d4cd6f0336f050841ac63230fb6be438f1bfa28
from django.db import transaction, load_backend
from testdjango import settings
from sqlalchemy import pool
pool_initialized = False
class hashabledict(dict):
def __hash__(self):
return hash(tuple(sorted(self.items())))
class hashablelist(list):
data = file("test_train")
relevance_file = file("train_relevance","w")
def dwell_to_relevance(time):
if time < 50:
return 0
elif 50 <= time <=399:
return 1
else:
return 2
4556 5092 0.7
4556 4785 0.75
4556 5397 0.7
4556 5139 0.75
4556 5937 0.833333333
4556 6220 0.7
4559 4563 0.75
4559 4770 0.75
4559 4837 0.75
4559 5640 0.75
4556 5092 0.7000
4556 4785 0.7500
4556 5397 0.7000
4556 5139 0.7500
4556 5937 0.8333
4556 6220 0.7000
4556 5139 0.7500
4556 6220 0.7063
4559 4563 0.7500
4559 4770 0.7500
#!/usr/bin/expect -f
# ./ssh.exp password 192.168.1.11 id
set name [lrange $argv 2 2]
set server [lrange $argv 1 1]
set pass [lrange $argv 0 0]
spawn ssh $name@$server
match_max 100000
expect "*?assword:*"
send -- "$pass\r"
@young001
young001 / gist:5517224
Created May 4, 2013 11:30
tmux configuration
#
# author: Xu Xiaodong <xxdlhy@gmail.com>
# modified: 2012 Apr 16
#
#-- base --#
unbind C-b
set -g prefix C-q
set -g default-terminal "screen-256color"
@young001
young001 / gist:5449751
Created April 24, 2013 05:04
mutil threads
import requests
from threading import Thread
import Queue
import httpsqs
import os
#gevent_profiler.print_percentages(True)
#gevent_profiler.time_blocking(True)
#gevent_profiler.set_stats_output('my-stats.txt')
@young001
young001 / mysql error in ubuntu
Created October 20, 2012 14:14
mysql error in ubuntu
┌─(young001@young001-HP-Elite-7100-Microtower-PC:pts/8)────────────────(/run/mysqld)─┐
└─(22:12:%)── sudo dpkg --configure mysql-server-5.5 ──(六,10月20)─┘
[sudo] password for young001:
Setting up mysql-server-5.5 (5.5.24-0ubuntu0.12.04.1) ...
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
mysql-server-5.5