Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Boros fr6nco

View GitHub Profile
View gist:10bd11151ba0c74cd0b773b045251c0d
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};
@fr6nco
fr6nco / sock_http_reuse.js
Last active Mar 12, 2018
reuse nodejs socket for HTTP request
View sock_http_reuse.js
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);
}
@fr6nco
fr6nco / upgrade_ovs_in_mininet.sh
Created Oct 19, 2017 — forked from pichuang/upgrade_ovs_in_mininet.sh
Installing new version of Open vSwitch 2.3.0 use Mininet
View upgrade_ovs_in_mininet.sh
#!/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