View gist:10bd11151ba0c74cd0b773b045251c0d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function emailExistsValidatorFn(userService: UserService, trueOnExists: boolean): AsyncValidatorFn { | |
console.log('validator triggered'); | |
return (control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> => { | |
console.log(userService); | |
return userService.checkIfEmailExists(control.value, trueOnExists).pipe( | |
take(1), | |
map((result: boolean) => { | |
console.log(result); | |
console.log('psovi nic'); | |
return result ? null : {'emailexists': true}; |
View sock_http_reuse.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const net = require('net'); | |
const http = require('http'); | |
let client = new net.Socket(); | |
let httpAgent = new http.Agent({keepAlive: true}); | |
let sock = httpAgent.createConnection({port: 80, host:'localhost'}, (err, sock) => { | |
if(err) { | |
console.error(err); | |
} |
View upgrade_ovs_in_mininet.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -ev | |
# Reference: https://github.com/mininet/mininet/wiki/Installing-new-version-of-Open-vSwitch | |
# How to test: ovs-vsctl -V | |
# Check permission | |
test $(id -u) -ne 0 && echo "This script must be run as root" && exit 0 | |
#Remove old version ovs | |
aptitude remove openvswitch-common openvswitch-datapath-dkms openvswitch-controller openvswitch-pki openvswitch-switch -y |