Skip to content

Instantly share code, notes, and snippets.

View EECOLOR's full-sized avatar

EECOLOR EECOLOR

  • Kaliber
  • Utrecht, Netherlands
View GitHub Profile
@EECOLOR
EECOLOR / wake-on-lan.sh
Created May 15, 2024 18:59
Send wake on lan to MAC
MAC=11:22:33:44:55:66
echo -e $(echo $(printf 'f%.0s' {1..12}; printf "$(echo $MAC | sed 's/://g')%.0s" {1..16}) | sed -e 's/../\\x&/g') | nc -w1 -u -b 255.255.255.255 4000
@EECOLOR
EECOLOR / list-users.bash
Last active May 15, 2024 08:17
List users and roles of all projects in csv for Google Cloud
#!/bin/bash
outfile="./iam-policy.csv"
echo "Project, Account, Role" > $outfile
for project in $(gcloud projects list --format="table(projectId)" --filter 'parent.id=... AND parent.type=organization' | tail -n +2 | cut -f2 -d$' ' | sed '/^$/d'); do
out=$(gcloud projects get-iam-policy $project --flatten="bindings[].members[]" --format="csv[no-heading](bindings.members,bindings.role)")
echo $project
for line in $out; do
echo "$project,$line" >> $outfile
@EECOLOR
EECOLOR / .git_situational_awareness.sh
Created March 26, 2023 08:04
Git Situational Awareness Bash
#!/usr/bin/env bash
PROMPT_GREEN='\001'`tput setaf 2`'\002'
PROMPT_PINK='\001'`tput setaf 5`'\002'
PROMPT_PLAIN='\001'`tput op`'\002'
function in_git_repo {
[ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1
}
@EECOLOR
EECOLOR / snippet_const_function.js
Last active April 1, 2022 21:41
snippet_const_function
const moreDetail = () => {
...
}
const detail1 = () => {
...
return moreDetail()
}
const detail2 = (input) => {
@EECOLOR
EECOLOR / 1.js
Created August 30, 2021 10:06
test
a
@EECOLOR
EECOLOR / .git_sit_awareness.sh
Last active May 8, 2020 07:43
.git_sit_awareness.sh
#!/usr/bin/env bash
PROMPT_GREEN='\001'`tput setaf 2`'\002'
PROMPT_PINK='\001'`tput setaf 5`'\002'
PROMPT_PLAIN='\001'`tput op`'\002'
function in_git_repo {
[ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1
}
@EECOLOR
EECOLOR / throttledChildAdded.js
Last active July 2, 2019 22:37 — forked from iclems/Firebase Lazy-Safe Iterator
This snippet enables to iterate over a Firebase reference in a non-blocking way. If you need to iterate over a large reference, a child_added query may block your Firebase as it will query the whole data before iteration. With this snippet, children are retrieved one by one, making it slower / safer.
module.exports = function throttledChildAdded(ref, callback, onError, sortChildKey = null /* uses `key` if null */) {
const state = { stopped: false }
let listener = null
throttledChildAdded({ state, endReached: lastSeen => { listener = listenForNewChildren({ startAfter: lastSeen }) } })
return () => {
state.stopped = true
if (listener) ref.off('child_added', listener)
@EECOLOR
EECOLOR / firebaseSaveFile.js
Created August 30, 2017 11:11
Saves a file to Firebase storage with token authentication as if created from the console.
const storage = require('@google-cloud/storage')
const createUuid = require("uuid-v4")
const credentials = require('./test-firebase-credentials.json')
const firebaseProjectName = 'test'
const bucketName = `${firebaseProjectName}.appspot.com`
const bucket = storage({ credentials }).bucket(bucketName)
module.exports = firebaseSaveFile

Keybase proof

I hereby claim:

  • I am eecolor on github.
  • I am eecolor (https://keybase.io/eecolor) on keybase.
  • I have a public key whose fingerprint is AF78 4091 483A 8E95 E0F4 FE7F 103A 000A 62BA 9F9B

To claim this, I am signing this object:

#!/bin/bash -e
#DEPLOY_SERVERS=(vm273 vm274)
#APP_NAME=via-autobeheer-app-test
#DIST=dist/
#STATUS_CHECK_BASE=https://via-autobeheer-app-tst.firebaseio.com
#STATUS_CHECK_LOCATIONS=(/userData/status /token/status)
#SERVICES=(authentication-service userdata-service)
# .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo. #