Skip to content

Instantly share code, notes, and snippets.

View ceth-x86's full-sized avatar

ceth ceth-x86

  • Amsterdam, Netherlands
View GitHub Profile
import { Component } from '@angular/core'
import { Router } from '@angular/router'
import { FormControl, FormGroup, Validators } from '@angular/forms'
import { EventService } from './event.service'
@Component({
selector: 'create-event',
templateUrl: 'app/create-event.component.html',
styles: [`
<div>
<form #eventForm="ngForm" (ngSubmit)="saveEvent(eventForm.value)">
<div class="form-group">
<label for="event-name">Event Name: </label>
<input (ngModel)="name" name="name" id="event-name" type="text"/>
</div>
<div class="form-group">
<label for="date">Date: </label>
<input (ngModel)="date" name="date" id="date" type="text"/>
</div>
@ceth-x86
ceth-x86 / some.md
Created May 19, 2019 21:12
test gist

I'm having an old friend for dinner.

@ceth-x86
ceth-x86 / code.sql
Created April 27, 2019 16:43
Lost update
-- first session
BEGIN TRANSACTION;
UPDATE employees SET salary = 57000 WHERE employee = 'Jack';
-- second session
BEGIN TRANSACTION;
UPDATE employees SET salary = 49000 WHERE employee = 'Jack';
COMMIT TRANSACTION;
-- first
@ceth-x86
ceth-x86 / code.sql
Created April 27, 2019 16:42
Phantom rows
-- first
BEGIN TRANSACTION;
-- second
BEGIN TRANSACTION;
SELECT * FROM employees WHERE salary > 50000;
-- first
BEGIN TRANSACTION;
UPDATE employees SET salary = 57000 WHERE employees = 'Jack';
@ceth-x86
ceth-x86 / code.sql
Created April 27, 2019 16:42
Non-repeatable reed
-- first
BEGIN TRANSACTION;
-- second
BEGIN TRANSACTION;
INSERT INTO paychecks SELECT name, salary FROM employees;
-- first
UPDATE employees SET salary = 57000 WHERE employee = 'Jack';
COMMIT TRANSACTION;
@ceth-x86
ceth-x86 / code.sql
Created April 27, 2019 16:41
Dirty reads
-- first
BEGIN TRANSACTION;
UPDATE employees SET salary = 57000 WHERE employee = 'Jack';
-- second
BEGIN TRANSACTION;
SELECT salary FROM employees WHERE employu = 'Jack';
COMMIT TRANSACTION;
-- first
@ceth-x86
ceth-x86 / 1-working-with-cluster.sh
Created April 21, 2019 11:57
Wiorking with kubernetes cluster
#Listing and Inspecting your cluster, pods, services and more.
kubectl cluster-info
#review status and roles
kubectl get nodes
#Additional information about each node in the cluster.
kubectl get nodes -o wide
#Let's get a list of pods...but there isn't any running.
@ceth-x86
ceth-x86 / 1-package-installation.sh
Last active April 21, 2019 08:14
Kubernetes: installing and configuring
#Setup
# 1. 3 VMs Ubuntu 16.04.5 or 18.04.1.0, 1 master, 2 nodes.
# 2. Static IPs on individual VMs
# 3. /etc/hosts hosts file includes name to IP mappings for VMs
# 4. Swap is disabled
# 5. Take snapshots prior to installations, this way you can install
# and revert to snapshot if needed
#Disable swap, swapoff then edit your fstab removing any entry for swap partitions
#You can recover the space with fdisk. You may want to reboot to ensure your config is ok.
@ceth-x86
ceth-x86 / 1-building-basics-of-monitors.ps1
Last active April 20, 2019 19:58
Detecting changes in your environment
<#
Scenario:
- Find a file's hash value
- Store the hash value and contents
- Change the file
- Compare hash values
- Report on changed content
Trigger --> Compare --> Action
#>