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 os | |
import logging | |
from logging.handlers import RotatingFileHandler | |
class RotatingFileHandlerPlus(RotatingFileHandler): | |
def __init__(self, filename, *arg, **kwarg): | |
logPath = os.environ.get('X_JOB_LOG_PATH') | |
if logPath: | |
filename = logPath |
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
input { | |
file { | |
path => "/Users/leo/Documents/Workspace/dev/messagesub/log.log" | |
type => "normal_log" | |
codec => multiline { | |
pattern => "^(?!\[\d{4})" | |
what => "previous" | |
negate => false | |
auto_flush_interval => 5 | |
} |
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
''' | |
*** | |
Modified generic daemon class | |
*** | |
Author: http://www.jejik.com/articles/2007/02/ | |
a_simple_unix_linux_daemon_in_python/www.boxedice.com | |
License: http://creativecommons.org/licenses/by-sa/3.0/ |
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
function render(data, indent, fromArray) { | |
if(data == undefined){ | |
return ''; | |
} | |
var preAppend = ''; | |
if(indent){ | |
preAppend = new Array(indent * 4 + 1).join(' '); |
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
<html> | |
<head> | |
<script type="text/javascript"> | |
function euclidean(p1, p2) { | |
var s = 0; | |
for (var i = 0, l = p1.length; i < l; i++) { | |
s += Math.pow(p1[i] - p2[i], 2) | |
} | |
return Math.sqrt(s); |
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 namedtuple | |
from math import sqrt | |
import random | |
try: | |
import Image | |
except ImportError: | |
from PIL import Image | |
Point = namedtuple('Point', ('coords', 'n', 'ct')) | |
Cluster = namedtuple('Cluster', ('points', 'center', 'n')) |
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 '------------------------' | |
echo 'start copy and restart' | |
echo '------------------------' | |
SERVICE_NAME=$1 | |
echo ------------------------ | |
echo $WORKSPACE | |
echo 'target server:' $Live_WEB | |
echo 'remote user:' $REMOTE_USER |
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
function mapFromArray(array, prop) { | |
var map = {}; | |
for (var i=0; i < array.length; i++) { | |
map[ array[i][prop] ] = array[i]; | |
} | |
return map; | |
} | |
function isEqual(a, b) { | |
return a.title === b.title; |
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 | |
CURRENT_PATH=`dirname $0` | |
PORT="10002" | |
#LOG4JS_CONFIG="../config/logger.json" | |
PID_FILE="$CURRENT_PATH/../run/pid" | |
############################ | |
# FUNCTION | |
############################ |
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
foreach ($project in Get-Project -All) { | |
$packages = Get-Package -ProjectName $project.ProjectName | |
foreach ($package in $packages) { | |
Uninstall-Package $package.Id -Force -ProjectName $project.ProjectName | |
} | |
foreach ($package in $packages) { | |
Install-Package $package.Id -ProjectName $project.ProjectName -Version $package.Version | |
} | |
} |