Skip to content

Instantly share code, notes, and snippets.

# python apy2.py devs+pools
{u'devs': [{u'STATUS': [{u'STATUS': u'S', u'Msg': u'2 GPU(s)', u'Code': 9, u'When': 1400491908, u'Description': u'sgminer 4.1.0'}], u'DEVS': [{u'Difficulty Accepted': 13.44731282, u'KHS 5s': 1492, u'Temperature': 72.0, u'KHS av': 1491, u'Difficulty Rejected': 0.3229786, u'GPU Voltage': 1.206, u'GPU Clock': 1155, u'Fan Speed': 772, u'Status': u'Alive', u'Device Rejected%': 2.305, u'Fan Percent': 19, u'Rejected': 33, u'Memory Clock': 1400, u'Hardware Errors': 0, u'Accepted': 1368, u'Last Share Pool': 0, u'Diff1 Work': 14.012, u'Total MH': 61247.3242, u'Enabled': u'Y', u'Device Elapsed': 41088, u'Device Hardware%': 0.0, u'Last Valid Work': 1400491884, u'Last Share Time': 1400491884, u'GPU': 0, u'MHS av': 1.4907, u'Last Share Difficulty': 0.01, u'MHS 5s': 1.4923, u'GPU Activity': 99, u'Intensity': u'0', u'Powertune': 0, u'Utility': 1.9977}, {u'Difficulty Accepted': 14.07803827, u'KHS 5s': 1490, u'Temperature': 68.0, u'KHS av': 1491, u'Difficulty Rejected': 0.41115032, u'GPU Voltage': 1
,
"intensity" : "20",
"thread-concurrency" : "0",
"gpu-threads" : "2",
"gpu-engine" : "1129",
"auto-fan" : true,
"gpu-memclock" : "1475",
"gpu-powertune" : "0",
import socket
import json
import sys
def linesplit(socket):
buffer = socket.recv(4096)
done = False
while not done:
more = socket.recv(4096)
if not more:
python apy2.py devs+pools
{u'devs': [{u'STATUS': [{u'STATUS': u'S', u'Msg': u'2 GPU(s)', u'Code': 9, u'When': 1400266089, u'Description': u'sgminer 4.1.0'}], u'DEVS': [{u'Difficulty Accepted': 25.98060299, u'KHS 5s': 1445, u'Temperature': 72.0, u'KHS av': 1445, u'Difficulty Rejected': 0.28234299, u'GPU Voltage': 1.206, u'GPU Clock': 1129, u'Fan Speed': 926, u'Status': u'Alive', u'Device Rejected%': 1.0695, u'Fan Percent': 18, u'Rejected': 28, u'Memory Clock': 1475, u'Hardware Errors': 0, u'Accepted': 2708, u'Last Share Pool': 0, u'Diff1 Work': 26.4, u'Total MH': 111112.3558, u'Enabled': u'Y', u'Device Elapsed': 76904, u'Device Hardware%': 0.0, u'Last Valid Work': 1400266068, u'Last Share Time': 1400266068, u'GPU': 0, u'MHS av': 1.4448, u'Last Share Difficulty': 0.00912884, u'MHS 5s': 1.4448, u'GPU Activity': 99, u'Intensity': u'20', u'Powertune': 0, u'Utility': 2.1128}, {u'Difficulty Accepted': 25.78941533, u'KHS 5s': 1444, u'Temperature': 73.0, u'KHS av': 1445, u'Difficulty Rejected': 0.27615807, u'GPU Volta
#!/usr/bin/env python2.7
# Copyright 2013 Setkeh Mkfr
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version. See COPYING for more details.
#Short Python Example for connecting to The Cgminer API
python apy2.py devs+pools
{u'devs': [{u'STATUS': [{u'STATUS': u'S', u'Msg': u'2 GPU(s)', u'Code': 9, u'When': 1400232806, u'Description': u'sgminer 4.1.0'}], u'DEVS': [{u'Difficulty Accepted': 14.46511925, u'KHS 5s': 1446, u'Temperature': 72.0, u'KHS av': 1445, u'Difficulty Rejected': 0.19042681, u'GPU Voltage': 1.206, u'GPU Clock': 1129, u'Fan Speed': 809, u'Status': u'Alive', u'Device Rejected%': 1.3137, u'Fan Percent': 18, u'Rejected': 19, u'Memory Clock': 1475, u'Hardware Errors': 0, u'Accepted': 1486, u'Last Share Pool': 0, u'Diff1 Work': 14.496, u'Total MH': 63025.7091, u'Enabled': u'Y', u'Device Elapsed': 43621, u'Device Hardware%': 0.0, u'Last Valid Work': 1400232803, u'Last Share Time': 1400232803, u'GPU': 0, u'MHS av': 1.4449, u'Last Share Difficulty': 0.0130624, u'MHS 5s': 1.4456, u'GPU Activity': 99, u'Intensity': u'20', u'Powertune': 0, u'Utility': 2.044}, {u'Difficulty Accepted': 14.99794462, u'KHS 5s': 1445, u'Temperature': 73.0, u'KHS av': 1444, u'Difficulty Rejected': 0.13034454, u'GPU Voltag
#!/bin/sh
# Batch Mysql databases and users' priveleges restore
# Backup directory
BDIR="/home/www/backup/mysql-15-Apr-2014"
LOG="restore.txt"
DATE=`date +%d-%b-%Y_%H:%M:%S`
DBL=`find "$BDIR" -type f \( ! -iname "*.sh" -a ! -iname "*.sql" -a ! -iname "*.txt" \) -print0 | xargs -0 basename -a|awk -F. '{print $1}'`
echo $DBL
exit 0
{
cat <<EOT
$expand this
EOT
cat <<"EOT"
don't $expand this
EOT
} | ssh root@$server 'cat - > /tmp/cardcheck.sh'
if_temp_mail() {
for server in "${miners[@]}"; do
cat <<EOF | ssh root@$server 'cat - > /tmp/cardcheck.sh'
this $expand
this $expand
EOF
cat <<'EOF'
dont $expand
dont $expand
dont $expand
cat <<"EOT"
don't $expand this
$expand this
EOT