This file contains hidden or 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
#!/bin/bash | |
# Elastic Serarch Start and Stop Script | |
ES_HOME="/opt/elsearch/elasticsearch" | |
ES_USER="esearch" | |
PID=$(ps ax | grep elasticsearch | grep $ES_HOME | grep -v grep | awk '{print $1}') | |
#echo $PID |
This file contains hidden or 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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: elasticsearch | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Starts elasticsearch | |
# Description: Starts elasticsearch using start-stop-daemon | |
### END INIT INFO |
This file contains hidden or 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
echo "This script will: | |
1) install all modules need to run web2py on Ubuntu/Debian | |
2) install web2py in /home/www-data/ | |
3) create a self signed sll certificate | |
4) setup web2py with mod_wsgi | |
5) overwrite /etc/apache2/sites-available/default | |
6) restart apache. | |
You may want to read this script before running it. |
This file contains hidden or 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 -*- | |
# <codecell> | |
# term frequency | |
from math import log | |
# XXX: Enter in a query term from the corpus variable | |
# QUERY_TERMS = ['mr.', 'green'] | |
This file contains hidden or 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 datetime import datetime | |
def time_average(time_1, time_2): | |
""" | |
return a the average time between time_1 and time_2 | |
as a string in the same format as the input | |
""" | |
FMT = '%M:%S:%f' |
This file contains hidden or 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
import sys | |
import unittest | |
def count(text): | |
# if the text is None or empty do nothing | |
if text: | |
text = text.replace(' ', '') | |
else: | |
return None |
This file contains hidden or 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
#!/bin/bash | |
# save this script in your bin directory source it. | |
# source cdb.sh | |
# (it would be nice to do that in your bash profile as well.) | |
# Then you can run the cdb function in every terminal and bookmark any path you like.s | |
function show_bookmark { | |
for f in `ls ~/.cd_bookmarks/` | |
do |
This file contains hidden or 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
import numpy as np | |
from scipy.optimize import fmin_cg | |
def cost(p, Y, R, alpha): | |
""" | |
Calculates collaborative filtering cost function. | |
Arguments | |
---------- |
This file contains hidden or 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 collections import Counter | |
import heapq | |
class Node(object): | |
def __init__(self, pairs, frequency): | |
self.pairs = pairs | |
self.frequency = frequency | |
def __repr__(self): | |
return repr(self.pairs) + ", " + repr(self.frequency) |
This file contains hidden or 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
svn st | grep ? | awk '{print $2}' | xargs svn add |