Skip to content

Instantly share code, notes, and snippets.

View fdonzello's full-sized avatar
🏠
Working from home

Francesco Donzello fdonzello

🏠
Working from home
View GitHub Profile
@fdonzello
fdonzello / metrics.yaml
Created July 5, 2021 10:41
metrics.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: metrics-server
name: metrics-server
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
@fdonzello
fdonzello / if-granted-usage.component.ts
Last active May 12, 2021 08:53
Usage of the if-granted component
import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core';
import {UserTypes} from '../../../models/models';
@Component({
selector: 'app-my-home',
template: `
This is visible to Admin, User and Guest.
<app-if-granted [allowedRoles]="[userTypes.Admin, userTypes.User]">
<!-- This is visible only to Admin and User -->
@fdonzello
fdonzello / if-granted.component.ts
Last active May 21, 2021 15:20
A simple component to wrap other components that can be shown only if the user is granted access to
import {Component, Input, OnInit} from '@angular/core';
import {UserTypes} from '../../models/models';
import {UserService} from '../../api/user.service';
import {map} from 'rxjs/operators';
@Component({
selector: 'app-if-granted',
template: `
<ng-container *ngIf="isGranted() | async">
<ng-content></ng-content>
package main
import "fmt"
func main() {
i := 0
i++
if i > 0 {
fmt.Println("i greater than 0")
@fdonzello
fdonzello / provision.sh
Last active February 10, 2020 15:05
Provision ubuntu with Minikube
#!/bin/sh
sudo apt update
sudo apt install -y curl docker.io
sudo setfacl --modify user:$(whoami):rw /var/run/docker.sock
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.6.2/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
sudo minikube start --vm-driver=none
alias minikube="sudo minikube"
@fdonzello
fdonzello / db.json
Last active February 5, 2019 08:28
Lux 04-05 Feb 19
{
"users": [
{
"id": 1,
"firstname": "Alan",
"lastname": "Sorrenti",
"email": "alan@email.me"
}
],
"news": [
@fdonzello
fdonzello / db.json
Created January 31, 2019 10:00
Lux 30-31-jan
{
"results": [
{
"id": 132579,
"day": 21,
"redaction_id": 2,
"player_id": 157,
"player_name": "H. Kane",
"played": true,
"arbitrary": false,
@fdonzello
fdonzello / db.json
Last active December 4, 2018 13:27
BRUX-4-12-18
{
"articles": [
{
"id": 1,
"title": "Belgium beers are awesome",
"description": "oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome oh yeah, awesome ",
"date": "2016-04-19T18:03:40.887",
"author": "francesco"
},
{
@fdonzello
fdonzello / server.js
Last active December 4, 2018 15:17
demo ng6
var sqlite3 = require("sqlite3").verbose();
var db = new sqlite3.Database("db");
db.serialize(function () {
db.run(
"CREATE TABLE IF NOT EXISTS users (name TEXT, password TEXT, role TEXT)"
);
db.run(
"INSERT INTO users (name, password, role) VALUES (?, ?, ?)",
"admin",
@fdonzello
fdonzello / .m
Created September 28, 2017 09:08
use
// creazione classe che gestisce le api per i feeds
FBLFeedsApi *feedsApi = [[FBLFeedsApi alloc] initWithFBLNetworkManager:BRIDGE_NETWORK_NEW_MANAGER];
// chiamata alle api (bloccante)
FBLFeedResponse *feedResponse = [feedsApi get];
if ( [feedResponse isSuccess] )
{
// ogni response è uguale. isSuccess, getData, ....
[feedResponse getData]....