Skip to content

Instantly share code, notes, and snippets.

View yesil's full-sized avatar
🍉

Ilyas Türkben yesil

🍉
View GitHub Profile
@yesil
yesil / wcs-overlay.min.js
Created August 15, 2024 16:11
WCS Overlay for adobe.com Milo pages
javascript:(function()%7Blet%20overlay%20%3D%20document.getElementById('wcs-osi-overlay')%3B%0Aif%20(overlay)%20%7B%0A%20%20overlay.style.display%20%3D%20overlay.style.display%20%3D%3D%3D%20'none'%20%3F%20''%20%3A%20'none'%3B%0A%7D%20else%20%7B%0A%20%20const%20style%20%3D%20document.createElement('style')%3B%0A%20%20style.innerHTML%20%3D%20%60%0A%23wcs-osi-overlay%20%7B%0Aposition%3A%20fixed%3B%0Atop%3A%2064px%3B%0Aright%3A%200px%3B%0Awidth%3A%20600px%3B%0Aheight%3A%20360px%3B%0Abackground-color%3A%20rgb(239%20221%20221)%3B%0Az-index%3A%201000%3B%0Adisplay%3A%20flex%3B%0Aflex-direction%3A%20column%3B%0Ajustify-content%3A%20center%3B%0Apadding%3A%2020px%3B%0Aborder%3A%202px%20solid%20%23e0e0e0%3B%0Aborder-radius%3A%208px%3B%0A%7D%0A%60%3B%0A%0A%20%20document.head.appendChild(style)%3B%0A%20%20overlay%20%3D%20document.createElement('div')%3B%0A%20%20overlay.setAttribute('id'%2C%20'wcs-osi-overlay')%3B%0A%20%20document.body.appendChild(overlay)%3B%0A%20%20document.body.addEventListener('mouseover'%2C%20(e)%20%3D
let overlay = document.getElementById('wcs-osi-overlay');
if (overlay) {
overlay.style.display = overlay.style.display === 'none' ? '' : 'none';
} else {
const style = document.createElement('style');
style.innerHTML = `
#wcs-osi-overlay {
position: fixed;
top: 64px;
right: 0px;
const createHash = require('create-hash')
const { Avalanche, BinTools, BN } = require('avalanche')
const { KeyChain } = require('avalanche/dist/apis/evm')
const avm = require('avalanche/dist/apis/avm')
const { Signature } = require('avalanche/dist/common/credentials')
const ava = new Avalanche('api.avax.network', 443, 'https')
const bintools = BinTools.getInstance()
const xchain = ava.XChain()
// work in progress
// white
const dead = 0;
// black
const alive = 1;
const asIs = 2;
// Get all alive neighbours
@yesil
yesil / promise-serial.js
Created December 14, 2017 22:24
Promises in serial
const tasks = getTaskArray();
return tasks.reduce((promiseChain, currentTask) => {
return promiseChain.then(chainResults =>
currentTask.then(currentResult =>
[ ...chainResults, currentResult ]
)
);
}, Promise.resolve([])).then(arrayOfResults => {
// Do something with all results
});
@yesil
yesil / Replication Receiver Wrapper
Last active December 6, 2016 14:47
Registers ReplicationReceiverWrapperFilter to the http service using Whiteboard
This filter is to be installed on a AEM publish instance.
It will buffer the replication request responses until completion before sending back a success (200).
This will help AEM author to detect that the replication request has really succeeded which is really important in case of package replications.
@yesil
yesil / package.json
Last active November 18, 2016 10:19
Simple proxy to alter the POST request content that is sent IdP
{
"name": "samlproxy",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ilyas Türkben",
"license": "ISC",
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
def removeLucene(session, index) {
def rootB = session.store.root.builder()
def luceneIndex = rootB.getChildNode("oak:index").getChildNode(index)
println luceneIndex.remove() ? "success" : "error"
session.store.merge(rootB, EmptyHook.INSTANCE, CommitInfo.EMPTY)
}
import org.apache.jackrabbit.oak.spi.state.NodeState
import org.apache.jackrabbit.oak.api.Type
class BlobSearch {
def session
def check(){
checkChildren(session.store.root.builder().nodeState)
}
@yesil
yesil / rename-node.groovy
Created May 11, 2016 16:53
groovy script to load in oak-run in order to rename protected node names.
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
def fixNodeType(session, nodeType) {
def rootB = session.store.root.builder()
def nodeTypeB = rootB.getChildNode("jcr:system").getChildNode("jcr:nodeTypes").getChildNode(nodeType)
def propertyDefinitionB = nodeTypeB.getChildNode("jcr:propertyDefinition")
def move = propertyDefinitionB.moveTo(nodeTypeB,"jcr:propertyDefinition[1]")
session.store.merge(rootB, EmptyHook.INSTANCE, CommitInfo.EMPTY)
println move ? "success" : "error"