Skip to content

Instantly share code, notes, and snippets.

@exbotanical
exbotanical / eve-linux.sh
Created March 9, 2020 04:56
eve linux configs
# eve-linux configurations - not a script, but cmds
# bluetooth
hcitool scan
var=DEVICE
# as root
@exbotanical
exbotanical / py_regex_notes.py
Created March 2, 2020 22:06
python, [regex, re module] (more notes re py roborant)
# # # REGEX # # #
# The ? matches zero or one of the preceding group.
# The * matches zero or more of the preceding group.
# The + matches one or more of the preceding group.
# The {n} matches exactly n of the preceding group.
# The {n,} matches n or more of the preceding group.
# The {,m} matches 0 to m of the preceding group.
# The {n,m} matches at least n and at most m of the preceding group.
# {n,m}? or *? or +? performs a non-greedy match of the preceding group.
@exbotanical
exbotanical / zipArrays.js
Created February 10, 2020 16:34
zip an object of arrays js
// zip object of arrays: { [],[], ... } -> [ arr1[0] + arr2[0] ], [ arr1[1], arr2[1], ... ]
const zip = (arrays) => {
return arrays[0].map(function(_,i){
return arrays.map(function(array){return array[i]})
})
}
// e.g.
// stateArray = Object.values(this.context.state).map(i => stateArray.concat(i))
// stateArray = this.zip(stateArray)
//convert string to url slug without affecting global variable
function urlSlug(title) {
return title.toLowerCase().trim().split(/\s+/).join("-")
}
//TO-DO: port this function into small application that generates url slugs