Skip to content

Instantly share code, notes, and snippets.

View reicheltp's full-sized avatar

Paul Reichelt-Ritter reicheltp

View GitHub Profile
@reicheltp
reicheltp / setup-pc.ps
Created September 10, 2019 14:42
setup-pc.ps
# Allow Remote Execution Policy (this maybe already needed to run this script)
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
# Install Scoop
iwr -useb get.scoop.sh | iex
# Use lessmsi to ensure it also run in any work environment
scoop config MSIEXTRACT_USE_LESSMSI $true
# Install core stuff
package main
import (
"encoding/json"
"fmt"
"math/rand"
"net/http"
"os"
"os/signal"
"sync"
@reicheltp
reicheltp / Startup.cs
Created April 3, 2019 14:32
Authorization Middleware aspnetcore2
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// We have to add Authorization and at least one policy with at least one requirement.
services.AddAuthorization(options => options.AddPolicy("default", a => a.RequireAuthenticatedUser()));
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"/>
<script dangerouslySetInnerHTML={{__html: `
function enableCookies() {
var s = document.createElement('script')
s.async = true
s.src = "https://www.googletagmanager.com/gtag/js?id=$_TRACKING_ID_$"
s.id = 'google-analytics-script-tag'
document.head.appendChild(s)
@reicheltp
reicheltp / mvvm_sample.cs
Created October 22, 2017 16:14
INPC INCC
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
namespace ConsoleApp1
{
class Program
@reicheltp
reicheltp / dgraph-client-sample.js
Last active April 29, 2017 15:39
dgraph-client-sample.js
import DgraphClient from 'dgraph-client';
// create a new client
let client = new DgraphClient('localhost:8080');
// set objects
let me = {name: 'Paul', size: 1.85, time: Date.now()};
await client.set(me);
// query objects
@reicheltp
reicheltp / update-protos.sh
Created April 25, 2017 21:21
update-protos.sh
IMPORT_GLOBAL="github.com/dgraph-io/dgraph/protos/"
IMPORT_LOCAL="../"
mkdir -p ./protos/facetsp
curl -s https://raw.githubusercontent.com/dgraph-io/dgraph/release/v0.7.5/protos/facetsp/facets.proto \
| sed "s,$IMPORT_GLOBAL,$IMPORT_LOCAL,g" > ./protos/facetsp/facets.proto
mkdir -p ./protos/graphp
curl https://raw.githubusercontent.com/dgraph-io/dgraph/release/v0.7.5/protos/graphp/graphresponse.proto \
| sed "s,$IMPORT_GLOBAL,$IMPORT_LOCAL,g" > ./protos/graphp/graphresponse.proto
@reicheltp
reicheltp / node-dgraph-query.js
Last active April 25, 2017 21:18
node-dgraph-query.js
let queryReq = new Request();
queryReq.query = "query { me(id:paul) { name, size } }";
dgraph.run(queryReq, (err, res) => {
// get me
let me = res.n[0].children[0];
// list all properties
me.properties.forEach(function (prop) {
console.log(prop.prop + ": " + prop.value[prop.value.val]);
@reicheltp
reicheltp / node-dgraph-mutation.js
Last active April 25, 2017 21:13
node-dgraph-mutation.js
let setReq = new Request();
setReq.mutation = new Mutation();
// a string value nquad
let nqName = new NQuad();
nqName.subject = 'paul';
nqName.predicate = 'name';
nqName.objectValue = new Value().set('str_val', 'Paul Reichelt');
nqName.objectType = 10;
This file has been truncated, but you can view the full file.
[{"pid":27552,"tid":21432,"ts":104081999565,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"c:\\jenkins\\workspace\\libchromiumcontent-win\\src\\components\\scheduler\\base\\task_queue_impl.cc","src_func":"scheduler::internal::TaskQueueImpl::PushOntoImmediateIncomingQueueLocked"},"dur":447,"tdur":390,"tts":344388},
{"pid":27552,"tid":21432,"ts":104081999905,"ph":"X","cat":"toplevel","name":"TaskQueueManager::ProcessTaskFromWorkQueue","args":{"src_file":"c:\\jenkins\\workspace\\libchromiumcontent-win\\src\\base\\trace_event\\trace_log.cc","src_func":"base::trace_event::TraceLog::SetEnabled"},"dur":13,"tdur":12,"tts":344678},
{"pid":27552,"tid":21432,"ts":104081999920,"ph":"X","cat":"toplevel","name":"TaskQueueManager::ProcessTaskFromWorkQueue","args":{"src_file":"c:\\jenkins\\workspace\\libchromiumcontent-win\\src\\base\\trace_event\\trace_log.cc","src_func":"base::trace_event::TraceLog::SetEnabled"},"dur":38,"tdur":38,"tts":344692},
{"pid":27552,"tid":21432,"ts":104081999961,"ph":"