Skip to content

Instantly share code, notes, and snippets.

View andrew-aladev's full-sized avatar
🐻

Andrew Aladjev andrew-aladev

🐻
View GitHub Profile
@andrew-aladev
andrew-aladev / ntfsundelete.rb
Last active August 29, 2015 14:11
Extract all files with ntfsundelete
#!/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
@andrew-aladev
andrew-aladev / anime_manifest
Last active August 29, 2015 14:13
Manifests for anime
#!/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")
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) {
#!/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)
@andrew-aladev
andrew-aladev / 7bit_hex_to_char.c
Last active September 24, 2021 17:55
Openwrt + Huawei E367 + balance of mts.by with bash and c
#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) {
@andrew-aladev
andrew-aladev / NJB1-Y3.man
Created November 30, 2015 21:36
Chint NJB1-Y3 switches
开关 - switch
功能 - function
自动复位 - automatic reset
手动复位 - manual reset
动作带闭 - action with closed
动作带开 - action with open
欠电压跳式 - undervoltage hop
过电压跳式 - overvoltage hop
@andrew-aladev
andrew-aladev / pdd.by data extractor
Last active January 21, 2016 20:48
pdd.by data extractor
We couldn’t find that file to show.
@andrew-aladev
andrew-aladev / gist:27b29228510c3ca5ee83d438e190a8ca
Created May 12, 2016 19:25
aria2 bittorent sequental.patch
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(),
@andrew-aladev
andrew-aladev / runCoordinatedTests.js.patch
Created August 17, 2016 15:47
Thali cputhrottle coordinated patch
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);
@andrew-aladev
andrew-aladev / jxcore install script
Last active September 1, 2016 10:54 — forked from mohlsen/jxcore install script
jx-install.sh
#!/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'