Consider a list of strings you need to permanently assign a random color.
First you should turn the string into a hash.
var string = "string"
var hash = 0
function ColorToHex(color) { | |
const hexadecimal = color.toString(16) | |
return hexadecimal.length === 1 ? "0" + hexadecimal : hexadecimal | |
} | |
const items = [ "cold", "semi-cold", "ok", "hot", "very_hot" ] | |
const items_colors = [] | |
let alpha = 0.0 |
def env = System.getenv() | |
if (env["DOCKER_HOST"]) { | |
println("This script will not work without a properly set up docker environment. Please define the environment variable 'DOCKER_HOST'") | |
false | |
} else { | |
runningDockers = "docker ps -q".execute().text.split(/\n/) | |
runningDockers.each {id -> println("docker stop ${id}".execute().text)} | |
stoppedDockers = "docker ps -a -f status=exited -q".execute().text.split(/\n/) |
curl -L -k -s https://www.example.com | tac | sed "s#\\\/#\/#g" | egrep -o "src['\"]?\s*[=:]\s*['\"]?[^'\"]+.js[^'\"> ]*" | awk -F '//' '{if(length($2))print "https://"$2}' | sort -fu | xargs -I '%' sh -c "curl -k -s \"%\" | sed \"s/[;}\)>]/\n/g\" | grep -Po \"(['\\\"](https?:)?[/]{1,2}[^'\\\"> ]{5,})|(\.(get|post|ajax|load)\s*\(\s*['\\\"](https?:)?[/]{1,2}[^'\\\"> ]{5,})\"" | awk -F "['\"]" '{print $2}' | sort -fu | |
# using linkfinder | |
function ejs() { | |
URL=$1; | |
curl -Lks $URL | tac | sed "s#\\\/#\/#g" | egrep -o "src['\"]?\s*[=:]\s*['\"]?[^'\"]+.js[^'\"> ]*" | sed -r "s/^src['\"]?[=:]['\"]//g" | awk -v url=$URL '{if(length($1)) if($1 ~/^http/) print $1; else if($1 ~/^\/\//) print "https:"$1; else print url"/"$1}' | sort -fu | xargs -I '%' sh -c "echo \"\n##### %\";wget --no-check-certificate --quiet \"%\"; basename \"%\" | xargs -I \"#\" sh -c 'linkfinder.py -o cli -i #'" | |
} | |
# with file download (the new best one): | |
# but there is a bug if you don't provide a root url |
" _ _ " | |
" _ /|| . . ||\ _ " | |
" ( } \||D ' ' ' C||/ { % " | |
" | /\__,=_[_] ' . . ' [_]_=,__/\ |" | |
" |_\_ |----| |----| _/_|" | |
" | |/ | | | | \| |" | |
" | /_ | | | | _\ |" | |
It is all fun and games until someone gets hacked! |
If you are setting up a new machine, first generate a key to the default `~/.ssh/id_rsa` by running: | |
```sh | |
ssh-keygen -t rsa | |
ssh-add ~/.ssh/id_rsa | |
``` | |
Next, for each company account you have, run this command (substituting companyName to something more meaningful), which tags the key with companyName and saves it to ~/.ssh/companyName | |
```sh |
If you need to do a proof of concept on Cloud Composer and Cloud SQL, here are some steps on how to do a SELECT query in Cloud SQL database from Cloud Composer instance - an Apache AirFlow managed service by Google Cloud Platform.
The following steps will incur you costs depending on the usage time you have for each instance created (both Cloud SQL and Composer).
server { | |
listen 80; | |
server_name your.domain.com; | |
location = /analytics.js { | |
# you have to compile nginx with http://nginx.org/en/docs/http/ngx_http_sub_module.html (this is not default) | |
# and http://nginx.org/en/docs/http/ngx_http_proxy_module.html (it's a default module) | |
proxy_set_header Accept-Encoding ""; |
const mongoConnect = async () => { | |
const dbUrl = `mongodb://${process.env.APP_MONGO_USER}:${process.env.APP_MONGO_PASS}@${ | |
process.env.APP_MONGO_HOST | |
}:${process.env.APP_MONGO_PORT}/${process.env.APP_MONGO_DB}`; | |
await mongoose | |
.connect(dbUrl, { | |
useNewUrlParser: true, | |
autoReconnect: true, | |
}) |
const bcrypt = require('bcryptjs'); | |
const exec = require('child_process').exec | |
const password = 'test'; | |
const cmd = '/usr/local/bin/php ./password.php' | |
exec(cmd, (err, stdout, stderr) => { | |
// See https://en.wikipedia.org/wiki/Bcrypt#Versioning_history | |
const hash = stdout.replace('$2y$', '$2a$'); |