Skip to content

Instantly share code, notes, and snippets.

View Just1B's full-sized avatar
πŸ‘¨β€πŸ’»

Justin Baroux Just1B

πŸ‘¨β€πŸ’»
View GitHub Profile
@Just1B
Just1B / interpolation.js
Created January 6, 2022 12:36
Generate Color Interpolations Between 2 colors
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
@Just1B
Just1B / docker_rmi.groovy
Last active March 6, 2021 11:43
Jenkins script from webui
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/)
@Just1B
Just1B / colors.md
Created May 8, 2020 12:12 — forked from 0x263b/colors.md
Random color from string in javascript

Random color from string in javascript

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
@Just1B
Just1B / ejs.sh
Created April 30, 2020 11:42 — forked from gwen001/ejs.sh
onliner to extract endpoints from JS files of a given host
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
@Just1B
Just1B / google-dorks
Created January 3, 2020 02:01 — forked from stevenswafford/google-dorks
Listing of a number of useful Google dorks.
" _ _ "
" _ /|| . . ||\ _ "
" ( } \||D ' ' ' C||/ { % "
" | /\__,=_[_] ' . . ' [_]_=,__/\ |"
" |_\_ |----| |----| _/_|"
" | |/ | | | | \| |"
" | /_ | | | | _\ |"
It is all fun and games until someone gets hacked!
@Just1B
Just1B / Multiple rsa keys
Last active March 6, 2021 11:45
Multiple SSH keys
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

Query Cloud SQL from Cloud Composer (Apache Airflow) task on GCP

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.

Heads up

The following steps will incur you costs depending on the usage time you have for each instance created (both Cloud SQL and Composer).

1. Create a Cloud Composer cluster (environment)

@Just1B
Just1B / 1.google-analytics-proxy-nginx.conf
Created September 4, 2019 16:28 — forked from paivaric/1.google-analytics-proxy-nginx.conf
Google Analytics Proxy using Nginx to bypass Adblock and other blockers
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 "";
@Just1B
Just1B / connection.js
Last active September 4, 2019 22:49
MongoDB docker
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,
})
@Just1B
Just1B / decript.js
Created May 29, 2019 13:44
Compare a PHP bcrypt hash with Node.js ( From angristan.xyz )
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$');