Skip to content

Instantly share code, notes, and snippets.

View yesil's full-sized avatar
🍉

Ilyas Türkben yesil

🍉
View GitHub Profile
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"
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
import org.apache.jackrabbit.oak.spi.state.NodeState
import org.apache.jackrabbit.oak.spi.state.NodeBuilder
class LibsCleaner {
def session
def scanBundles(remove = false) {
@yesil
yesil / jenkins-groovy-command-ace-support.js
Created February 26, 2013 15:22
This script creates a nice code editor thanks to the beautiful ace library for the groovy command in jenkins job configurations. The files mode-groovy.js theme-textmate.js should be in the directory jenkins/userContent The ace library itself can be set in the javascript console. This script is tested only with chrome.
ace.config.set("modePath", "/userContent");
ace.config.set("themePath", "/userContent");
var groovyCommand = document.getElementsByName("groovy.command")[0];
groovyCommand.setStyle('position:absolute;top:-10000px;left;-10000px;');
var editor = document.createElement('div');
editor.setAttribute('id','editor');
editor.setStyle('position:relative; width:100%; min-height:500px;');
editor.textContent = groovyCommand.textContent;