Skip to content

Instantly share code, notes, and snippets.

@jstortz
jstortz / OCM Bookmarklets.md
Created October 15, 2021 19:06 — forked from tcaruth/OCM Bookmarklets.md
OCM Bookmarklets

OCM Specific

Get an OAuth token for whatever OCM site you're on

I was tired of trying to select exactly the token part of the JSON so I can paste it into Postman, so I made this

javascript:window.location.href.includes(".com/documents")?$.post(window.location.origin+"/system/api/v1/security/token").done((e=>{let o=document.createElement("input");o.value=e.accessToken,document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)})).fail(((e,o,t)=>{alert("Failed with HTTP code:"+e.status)})):alert("Only usable from OCM dashboards")

Copy the first checked site/asset id from OCM dashboards

I was tired of inspecting, finding the li and the ID, then going to the documents, entering a folder, pasting my ID over the ID in the URL. As a nice benefit, it also copies selected asset IDs from the viewer, and document IDs from the documents page.

@jstortz
jstortz / gist:c8b3e816b4e200b640140d57840137ba
Created October 15, 2021 18:49
OCM Copy Site, Asset or Document ID Bookmarklet
// Credit Travis Caruth
javascript:{let e;if(window.location.href.includes("oraclecloud.com/documents")){e=document.createElement("input");try{e.value=document.querySelector("li.selected").id}catch{alert("Select an item first")}44==e.value.length&&e.value.startsWith("F")&&(window.location.href=window.location.origin+"/documents/folder/"+e.value),document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),alert("Copied")}else alert("Only usable from OCM dashboards")}
@jstortz
jstortz / lastProject.js
Created November 19, 2019 12:09
Get the Last Project Page
// Minify this code over at:
// https://javascript-minifier.com/
// Then added the resulting code as a bookmark prefixed with "javascript:"
// Store a reference to the editingFrame SCS object for easy reference
const SCS = window.frames['editingFrame'].contentWindow.SCS;
// Get the last event child of the "Events" page
const lastItem = Object.values(SCS.structureMap).find(p => p.name === 'Our Work').children.lastItem;
@jstortz
jstortz / lastEvent.js
Created November 19, 2019 12:01
Navigate to Last Event Page
// Minify this code over at:
// https://javascript-minifier.com/
// Then added the resulting code as a bookmark prefixed with "javascript:"
// Store a reference to the editingFrame SCS object for easy reference
const SCS = window.frames['editingFrame'].contentWindow.SCS;
// Get the last event child of the "Events" page
const lastItem = Object.values(SCS.structureMap).find(p => p.name === 'Events').children.lastItem;
console.log('hi there');
#!/bin/bash
# Use this file to produce an auto-complete command for OCE Toolkit Commands
#
# Usage:
# $ chmod +x ./oce-toolkit-autocomplete.sh
# $ ./oce-toolkit-autocomplete.sh
#
# Then add the output to your .bash_profile or .bash_rc file
#
# Finally, start a new terminal window/tab and you should be able to autocomplete cec primary commands
#!/bin/bash
# Get the list of templates
# Drop the first four lines
OUTPUT="$(cec list --types templates -s dev | tail -n +4)"
# Loop the list
while read -r line; do
# Get the first word, the temlate name
@jstortz
jstortz / clean_node_modules.txt
Last active May 28, 2019 15:50
Remove all sub-directories named "node_modules".
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
@jstortz
jstortz / appinfo.json
Created November 2, 2018 13:42 — forked from brito/appinfo.json
Minimal SCS Custom Component
{
"settingsData": {
"settingsHeight": 90,
"settingsWidth": 300,
"settingsRenderOption": "inline"
},
"initialData": {
"customSettingsData": {
"screen_name": "redlabelapp"
#!/bin/bash
# Lots could be better in this script
# TODO: Take output file name as parameter
# TODO: Take PID as parameter
rm -f threaddumps.txt
for i in {1..5}
do
echo $(date '+THREAD DUMPED AT: %H:%M:%S') >> threaddumps.txt