function ConvertTo-Hex([byte[]]$bytes)
{
return ($bytes | % { $_.ToString("X2") }) -join ""
}
function ConvertTo-Bytes([string]$hex)
set -e
set -o pipefail
# -e (errexit): Abort script at first error, when a command exits with non-zero status (except in until or while loops, if-tests, list constructs)
# In case script is calling subscript inside, the pipefail option can be useful.
# -o pipefail: Causes a pipeline to return the exit status of the last command in the pipe that returned a non-zero return value.
This file contains hidden or 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
<?xml version="1.0" encoding="utf-16"?> | |
<StorableColorTheme xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<Keys> | |
<string>ErrorForegroundColor</string> | |
<string>ErrorBackgroundColor</string> | |
<string>WarningForegroundColor</string> | |
<string>WarningBackgroundColor</string> | |
<string>VerboseForegroundColor</string> | |
<string>VerboseBackgroundColor</string> | |
<string>DebugForegroundColor</string> |
Do not store users' passwords in plain text, store hash of password instead. But only hashing is not enough, use one of these techniques, to make your users' data more protected:
- simple way:
passwordHash = hash( hash(passwd) + salt )
- better one - will produce different hashes for users with the same passwords:
This file contains hidden or 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
param( | |
[Parameter(Mandatory=$true)] | |
$source, | |
[Parameter(Mandatory=$true)] | |
$output, | |
$header = "/// © Pavel Timofeev", | |
$excludes = @("AssemblyInfo.cs", "*.Designer.cs", "TemporaryGeneratedFile_*" ), | |
$copyAsIs = @(), # list of filemasks that should be copy as is without merge | |
$addFileNames = $false, # add names of src files | |
$leftComments = $false, # remove line commented with // |
nginx.com example
nginx-caching
http {
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g;
server {
This file contains hidden or 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
var os = require("os"); | |
//Create function to get CPU information | |
function cpuAverage() { | |
//Initialise sum of idle and time of cores and fetch CPU info | |
var totalIdle = 0, totalTick = 0; | |
var cpus = os.cpus(); | |
//Loop through CPU cores |