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 | |
# получить открытые коннекты к mongos на балансере | |
HOSTS=('pm.back4' 'pm.back5' 'pm.back6') | |
file_name=$(date +"%F_%H_%M_%S") | |
for host in ${HOSTS[@]}; do | |
remote_cmd="sudo -u www-data netstat -ntp 2>/dev/null | grep 27027 | grep ESTABLISHED" | |
conn=$(ssh -p 60222 atairov@$host $remote_cmd | awk '{print $4, $7}' | sort) | |
echo "$conn" |
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
MongoLog::setLevel(MongoLog::ALL); | |
MongoLog::setModule(MongoLog::ALL); | |
MongoLog::setCallback('printLogs'); | |
function printLogs($m, $l, $mesg) | |
{ | |
echo $m, ' ', $l, ': ', $mesg, "\n"; | |
} | |
MongoClient::getConnections(); |
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
redis-cli -p 6380 SMEMBERS some_set | grep 2046 | xargs -L 1 -I{} redis-cli -p 6380 SISMEMBER some_set {} |
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 | |
cd /home/cube/backups | |
for i in *.tar; | |
do | |
# username:password - имя пользователя и | |
# пароль к аккаунту Яндекса | |
curl -T ${i} --user username:password https://webdav.yandex.ru | |
rm ${i} | |
done |
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
public static function getGitRev() | |
{ | |
if (APPLICATION_ENV == 'local') return time(); | |
if (!isset(self::$_gitRev)) { | |
self::$_gitRev = 0; | |
self::$_gitRev = trim(@file_get_contents(APPLICATION_PATH . '/../.git/ORIG_HEAD')) ?: md5(time()); | |
} | |
return self::$_gitRev; |
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 setCookie(c_name,value,exdays) | |
{ | |
var exdate=new Date(); | |
exdate.setDate(exdate.getDate() + exdays); | |
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); | |
document.cookie=c_name + "=" + c_value; | |
} |
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
# initial sync | |
indexer full_new delta_new && indexer --merge full_new delta_new | |
5 * * * * indexer delta_new --rotate >> /var/log/delta.new.log 2>&1 && indexer --merge full_new delta_new --rotate >> /var/log/sphinx.full.new.log 2>&1 |
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
(none):~# cat /etc/nginx/sites-enabled/proxy | |
server { | |
resolver 8.8.8.8; | |
access_log off; | |
listen [::]:8080; | |
location / { | |
proxy_pass $scheme://$host$request_uri; | |
proxy_set_header Host $http_host; | |
proxy_buffers 256 4k; | |
proxy_max_temp_file_size 0k; |
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
var ns = "mydb.mycollection" //the full namespace of the collection | |
var key = { "su" : 1, "sd" : 1 } //the shard key of the collection | |
db.getSiblingDB("config").chunks.find({ns : ns}).forEach(function(chunk) { | |
var ds = db.getSiblingDB(ns.split(".")[0]).runCommand({datasize:chunk.ns,keyPattern:key,min:chunk.min,max:chunk.max}); | |
print("Chunk: "+chunk._id +" has a size of "+ds.size+", and includes "+ds.numObjects+" objects (took "+ds.millis+"ms)") | |
} | |
) |
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
apt-get install libexpat1 libexpat1-dev | |
./configure --sysconfdir=/etc/sphinxsearch | |
checkinstall |