Skip to content

Instantly share code, notes, and snippets.

View KaiWedekind's full-sized avatar
:octocat:
Strongest Avenger.

Kai Wedekind KaiWedekind

:octocat:
Strongest Avenger.
  • IBM Deutschland GmbH
  • Germany
View GitHub Profile
@KaiWedekind
KaiWedekind / private_fork.md
Created April 27, 2022 17:03 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

# This tells kubecfg to read its config from the local directory
export KUBECONFIG=./kubeconfig
# Looking at the cluster
kubectl get nodes
kubectl get pods --namespace=kube-system
# Running a single pod
kubectl run --generator=run-pod/v1 --image=gcr.io/kuar-demo/kuard-amd64:1 kuard
kubectl get pods

Participants should have a recent version of Node.js installed on their system (preferably the latest LTS version, which is 6.9.1 as of this writing—but anything from 0.10 on should work). Participants should clone the following repositories and run npm install in each of them prior to the start of the workshop.

Optional: It might be helpful to install Electron globally so that you can use it from the command line in case there are any issues with any of the dependencies in the project above. You can install this through npm install -g electron.

Finally, debugging the main process is easiest using Visual Studio Code, which is available for all platforms (Windows, Linux, and macOS). This is not a hard requirement, but helpful if you'd like to follow along for that small segment of the workshop.

@KaiWedekind
KaiWedekind / electron-fem-v2.md
Created February 21, 2019 21:10 — forked from stevekinney/electron-fem-v2.md
Frontend Masters: Electron Workshop (December, 2018)

Frontend Masters: Electron (Version 2)

You'll need a recent version of Node.js installed on your computer with administrative access. Yarn is not required, but Electron Forge uses it, so it would be helpful to install beforehand.

Please make sure you're using a supported platform. This is particularly important if you're running Linux.

Important note: If you're using Windows, make sure you're not using the Windows Subsystem for Linux. This will confuse Electron to thinking you're running on a Linux machine when you're really not.

We'll be using working through the following repositories over the course of the workshop:

network.train(data, {
iterations: 20000, // the maximum times to iterate the training data --> number greater than 0
errorThresh: 0.005, // the acceptable error percentage from training data --> number between 0 and 1
log: false, // true to use console.log, when a function is supplied it is used --> Either true or a function
logPeriod: 10, // iterations between logging out --> number greater than 0
learningRate: 0.3, // scales with delta to effect training rate --> number between 0 and 1
momentum: 0.1, // scales with next layer's change value --> number between 0 and 1
callback: null, // a periodic call back that can be triggered while training --> null or function
callbackPeriod: 10, // the number of iterations through the training data between callback calls --> number greater than 0
timeout: Infinity // the max number of milliseconds to train for --> number greater than 0
'use strict'
const brain = require('brain.js');
const data = require('./training-data.json');
const network = new brain.NeuralNetwork();
network.train(data, { log: true });
const result = network.run({ r: 0, g: 1, b: 0.65 });
[
{ "input": { "r": "0.00", "g": "0.00", "b": "0.00" }, "output": { "white": 1 } },
{ "input": { "r": "0.85", "g": "0.88", "b": "0.56" }, "output": { "black": 1 } },
{ "input": { "r": "0.33", "g": "0.35", "b": "0.84" }, "output": { "white": 1 } },
{ "input": { "r": "0.00", "g": "0.99", "b": "1.00" }, "output": { "black": 1 } }
]
function getContrastYIQ(hexcolor){
var r = parseInt(hexcolor.substr(0, 2), 16);
var g = parseInt(hexcolor.substr(2, 2), 16);
var b = parseInt(hexcolor.substr(4, 2), 16);
var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
return (yiq >= 128) ? 'black' : 'white';
}
function getContrast50(hex){
return (parseInt(hex, 16) > 0xffffff/2) ? 'black': 'white';
}
@KaiWedekind
KaiWedekind / my-todos.js
Last active August 13, 2018 06:35
Lifecycle callbacks
class MyTodos extends HTMLElement {
// called when the HTML parser sees the HTML tag
constructor () {
// always call super() first in your constructor to inherit from your parent class
super();
this.title = 'My todos';
}
// called when the element is inserted in the DOM
// immediately after constructor if the element is in the DOM already