This file contains 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
#!/usr/bin/ruby21 | |
require "optparse" | |
require "open3" | |
require "shellwords" | |
require "fileutils" | |
options = {} | |
options_parser = OptionParser.new do |options_data| | |
options_data.on("-i", "--input INPUT", "Path to disk (/dev/sdc5)") do |input| | |
options[:input] = input |
This file contains 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 | |
files=() | |
while IFS= read -r -u3 -d $'\0' file; do | |
files+=("$file") | |
done 3< <(find "./" -not -path "./Manifests/*" -type f -print0) | |
files_count=${#files[@]} | |
(mkdir -p "./Manifests") | |
hash_methods=("ripemd160" "md5" "sha512" "whirlpool") |
This file contains 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
String.prototype.lpad = function (padding, length) { | |
var string = this; | |
while (string.length < length) { | |
string = padding + string; | |
} | |
return string; | |
} | |
Number.prototype.round = function(base) { | |
if (base == null || base < 0) { |
This file contains 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
#!/usr/bin/env ruby | |
require "bencode" | |
require "mongoid" | |
if ARGV.length != 1 | |
raise "required argument: directory" | |
end | |
dir = File.expand_path(ARGV[0]) | |
unless File.directory?(dir) |
This file contains 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
#include <stdint.h> | |
#include <stdio.h> | |
#include <string.h> | |
uint8_t get_data(char input, uint8_t *output) { | |
if (input - '0' >= 0 && '9' - input >= 0) { | |
*output = input - '0'; | |
} else if (input - 'a' >= 0 && 'f' - input >= 0) { | |
*output = input - 'a' + 10; | |
} else if (input - 'A' >= 0 && 'F' - input >= 0) { |
This file contains 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
开关 - switch | |
功能 - function | |
自动复位 - automatic reset | |
手动复位 - manual reset | |
动作带闭 - action with closed | |
动作带开 - action with open | |
欠电压跳式 - undervoltage hop | |
过电压跳式 - overvoltage hop |
This file contains 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
diff --git a/src/PieceStatMan.cc b/src/PieceStatMan.cc | |
index e869cff..ef8ac1c 100644 | |
--- a/src/PieceStatMan.cc | |
+++ b/src/PieceStatMan.cc | |
@@ -50,10 +50,10 @@ PieceStatMan::PieceStatMan(size_t pieceNum, bool randomShuffle): | |
order_[i] = i; | |
} | |
// we need some randomness in ordering. | |
- if(randomShuffle) { | |
- std::random_shuffle(order_.begin(), order_.end(), |
This file contains 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
diff --git a/test/www/jxcore/runCoordinatedTests.js b/test/www/jxcore/runCoordinatedTests.js | |
index 266cd04..8e3bfa3 100644 | |
--- a/test/www/jxcore/runCoordinatedTests.js | |
+++ b/test/www/jxcore/runCoordinatedTests.js | |
@@ -103,7 +103,9 @@ var testServerConfiguration = { | |
var testServerInstance = spawn('jx', ['../../TestServer/index.js', | |
JSON.stringify(testServerConfiguration)]); | |
+var cputhrottle = spawn('/Users/hiqouser/Downloads/cputhrottle', [testServerInstance.pid, 1]); | |
setListeners(testServerInstance, 0); |
This file contains 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 | |
# based on https://github.com/jxcore/jxcore/blob/master/tools/jx_install.sh | |
# changed because jxcore.com was down and the aws instance no longer exists | |
NORMAL_COLOR='\033[0m' | |
RED_COLOR='\033[0;31m' | |
GREEN_COLOR='\033[0;32m' | |
GRAY_COLOR='\033[0;37m' | |
MAGENTA_COLOR='\033[0;35m' |