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
public extension Array where Element: FloatingPoint { | |
func normalized(scale: Element) -> [Element] { | |
guard let maxVal = self.max(), let minVal = self.min() else { | |
return [] | |
} | |
let diff = maxVal - minVal | |
return self.map { val in | |
((val - minVal) / diff) * scale | |
} | |
} |
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 | |
ver=`lsb_release -r | awk '{print $2}'` | |
db="" | |
dbSrc="" | |
if [[ $ver == "14.04" ]]; then | |
db="http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main" | |
dbSrc="http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main" | |
elif [[ $ver == "15.10" ]]; then | |
db="http://apt.llvm.org/wily/ llvm-toolchain-wily-4.0 main" |
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 | |
errLogPath=".err.log" | |
exec 3>&1 | |
exec > /dev/null 2> $errLogPath | |
echo "" > $errLogPath | |
function echoStd { | |
while (( "$#" )); do | |
echo $1 >&3 | |
shift |
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
p cnf 20 91 | |
4 -18 19 0 | |
3 18 -5 0 | |
-5 -8 -15 0 | |
-20 7 -16 0 | |
10 -13 -7 0 | |
-12 -9 17 0 | |
17 19 5 0 | |
-16 9 15 0 | |
11 -5 -14 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
import SwiftyCurl | |
import Foundation | |
import CCurl | |
///// SwiftyCurl | |
var request = cURLRequest(url: URL(string: "https://jsonplaceholder.typicode.com/posts")!, | |
method: .get) | |
request.contentType = .json |
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 | |
sudo su - | |
echo 5 > /proc/sys/net/ipv4/route/gc_timeout | |
echo 5 > /proc/sys/net/ipv4/neigh/default/gc_stale_time |
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 | |
sudo apt-get install php-fpm php-mysql |
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 | |
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip libssl-dev | |
NPS_VERSION=1.12.34.3-stable | |
cd | |
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}.zip | |
unzip v${NPS_VERSION}.zip | |
cd ngx_pagespeed-${NPS_VERSION}/ | |
NPS_RELEASE_NUMBER=${NPS_VERSION/beta/} | |
NPS_RELEASE_NUMBER=${NPS_VERSION/stable/} |
NewerOlder