Skip to content

Instantly share code, notes, and snippets.

Pavel Veller pveller

Block or report user

Report or block pveller

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pveller
pveller / pubsub.js
Last active Aug 21, 2019
AWS Amplify PubSub with IoT and Cognito
View pubsub.js
/*
In order to subscribe to the AWS IoT topic over WS (over MQQT),
you have to make sure that your Cognito identity has a proper IoT policy attached to it.
More details and the message from the official AWS support:
https://github.com/aws/aws-amplify/issues/749
This code shows how you can dynamically attach a policy to the authenticated identity.
Make sure that your Authenticated IAM in the Cognito User Pool has proper IoT permissions.
@pveller
pveller / import.ps1
Last active May 17, 2019
Sitecore Content Import with Powershell
View import.ps1
# http://jockstothecore.com/content-import-with-powershell-treasure-hunt
function NormalizeName($name)
{
# replace all special symbols with single spaces
$name = $name -replace "[^a-zA-Z0-9]", " " -replace "\s+", ""
return $name.Trim()
}
@pveller
pveller / transcript.js
Last active Apr 11, 2017
Conversation Transcript with Bot Framework
View transcript.js
// Read more on http://www.pveller.com/smarter-conversations-part-4-transcript/
const transcript = function (session, direction, message, next) {
session.privateConversationData.transcript = session.privateConversationData.transcript || [];
session.privateConversationData.transcript.push({
direction,
message,
timestamp: new Date().toUTCString()
});
View sitecore-text-classifier.ps1
$page = Get-Item -Path '/sitecore/content/Habitat/Home/Modules/Feature/Accounts'
$links = [Sitecore.Globals]::LinkDatabase
$processed = New-Object System.Collections.ArrayList
# template names of items that will be linked from the presentation field that are not datasources
$skip = @('Device','Layout','View rendering', 'Controller rendering', 'Test Definition', 'Multivariate Test Variable')
# shared and final layout
$layouts = @('{F1A1FE9E-A60C-4DDB-A3A0-BB5B29FE732E}', '{04BF00DB-F5FB-41F7-8AB7-22408372A981}')
@pveller
pveller / sitecore-images-classifier.ps1
Created Sep 7, 2016
Using Microsoft Computer Vision API to automatically tag and describe Sitecore Habitat images (http://www.pveller.com/image-tagging-automation-with-computer-vision)
View sitecore-images-classifier.ps1
$vision = 'https://api.projectoxford.ai/vision/v1.0/analyze'
$features = 'Categories,Tags,Description,Color'
$images = Get-ChildItem -Path '/sitecore/media library/Habitat/Images/Square'
$result = @()
foreach ($image in $images)
{
# Reading the binary of the image so that we could send it to the Computer Vision API
$media_url = New-Object 'Sitecore.Resources.Media.MediaUri' $image
@pveller
pveller / CustomJettyLauncher.java
Created Jun 1, 2012
GWT Jetty Launcher to work with JNDI in the hosted mode (dev)
View CustomJettyLauncher.java
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
You can’t perform that action at this time.