Skip to content

Instantly share code, notes, and snippets.

View DavidForster's full-sized avatar
💻

David Forster DavidForster

💻
View GitHub Profile
@DavidForster
DavidForster / main.rs
Last active November 17, 2021 18:27
Find substrings in the first 5000 digits of Pi
use std::fs;
fn main() {
// load file as string
let contents = fs::read_to_string("pi5000.txt").expect("Something went wrong reading the file");
let mut found = 0;
let mut notfound = 0;
println!("{}", contents);
@DavidForster
DavidForster / euromillions.go
Created February 10, 2021 16:57
go program to select Euromillions numbers
package main
import (
"fmt"
"math/rand"
"sort"
"time"
)
type euroMillions struct {
@DavidForster
DavidForster / UpdateNamespace.groovy
Last active November 5, 2020 13:55
Bloomreach Experience Manager Groovy updater script to change the namespace of documents
package org.hippoecm.frontend.plugins.cms.admin.updater
import org.onehippo.repository.update.BaseNodeUpdateVisitor
import javax.jcr.Node
import javax.jcr.RepositoryException
import javax.jcr.Session
class UpdaterNamespace extends BaseNodeUpdateVisitor {
String findNamespace;
@DavidForster
DavidForster / PropertyUpdater.groovy
Created October 14, 2020 15:34
Bloomreach Experience Manager Groovy updater script to replace specific values on nodes
package org.hippoecm.frontend.plugins.cms.dev.updater;
import org.onehippo.repository.update.BaseNodeUpdateVisitor;
import javax.jcr.Node;
class PropertyUpdater extends BaseNodeUpdateVisitor {
String propertyToFind;
String valueToFind;
String valueToReplace;
@DavidForster
DavidForster / Keybase.md
Created March 25, 2019 11:15
Keybase.md

Keybase proof

I hereby claim:

  • I am davidforster on github.
  • I am davidforster (https://keybase.io/davidforster) on keybase.
  • I have a public key ASCjTng7Hfw6a_9U1fufmLu4gd1hzrD7mmv_w-UkwuxYoQo

To claim this, I am signing this object:

@DavidForster
DavidForster / CoreService_GetClient.cs
Last active March 1, 2016 21:19
Configuration-less Core Service Client
static ICoreService GetClient(string hostname, string username, string password)
{
var binding = new BasicHttpBinding()
{
MaxBufferSize = int.MaxValue,
MaxBufferPoolSize = int.MaxValue,
MaxReceivedMessageSize = int.MaxValue,
ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas()
{
MaxStringContentLength = int.MaxValue,
@DavidForster
DavidForster / CreateTestData.cs
Last active December 22, 2015 09:59
Example SDL Tridion .Net templates to create a JSON file as a package item and then publish it as a binary variant
using Tridion.ContentManager.Templating;
using Tridion.ContentManager.Templating.Assembly;
namespace Test.JsonTemplates
{
class CreateTestData : ITemplate
{
public void Transform(Engine engine, Package package)
{
string JSON = "{\"h3title\":\"09/04/2013\"}";