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
# -*- encoding: utf-8 -*- | |
# Author: Epix | |
# | |
# Ban Xunlei IP for deluge | |
# This script will check deluge connected peers per 30 seconds. | |
# When an IP with UA in `BAN_PATTERNS` is found, the IP will be added to `BLOCK_LIST_FILE`. | |
# However if the IP is uploading or reporting 100% progress, it will say "WTF?" | |
import logging |
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
function Add-EnvPath { | |
param( | |
[Parameter(Mandatory=$true)] | |
[string] $Path, | |
[ValidateSet('Machine', 'User', 'Session')] | |
[string] $Container = 'Session' | |
) | |
if ($Container -ne 'Session') { |
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
data AbstractInteger = Zero | Succ AbstractInteger | Pred AbstractInteger | |
deriving (Eq, Show) | |
instance Ord AbstractInteger where | |
-- compare :: AbstractInteger -> AbstractInteger -> Ordering | |
compare (Pred x) (Pred y) = compare x y | |
compare (Pred _) Zero = LT | |
compare (Pred _) (Succ _) = LT | |
compare Zero (Pred _) = GT | |
compare Zero Zero = EQ |
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
# function processes each sub-directory and then adds each source file in directory | |
# each function should cascade back upward in setting variables so that the bottom directory | |
# adds its source first, and then the level above it adds its source and passes both up, and so on... | |
function( recursively_include_src which_directory return_variable ) | |
if( ${return_variable} STREQUAL "headers" ) | |
set( file_extension ".h" ) | |
else( ${return_variable} STREQUAL "headers" ) | |
set( file_extension ".c" ) | |
endif( ${return_variable} STREQUAL "headers" ) |