Skip to content

Instantly share code, notes, and snippets.

@vsaw
vsaw / angular-fire-auth-guard-fix.guard.ts
Last active May 18, 2020 10:14
Fixes NgZone Issues in angularfire auth as described in https://github.com/angular/angularfire/issues/2355
import { Injectable, Inject, Optional, NgZone } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';
import { Observable, of, pipe, UnaryFunction } from 'rxjs';
import { map, switchMap, take, observeOn, shareReplay } from 'rxjs/operators'
import { User } from 'firebase/app';
import { ɵAngularFireSchedulers, FirebaseOptions, FirebaseAppConfig, FIREBASE_OPTIONS, FIREBASE_APP_NAME, ɵfirebaseAppFactory, ɵZoneScheduler } from '@angular/fire';
export type AuthPipeGenerator = (next: ActivatedRouteSnapshot, state: RouterStateSnapshot) => AuthPipe;
export type AuthPipe = UnaryFunction<Observable<User | null>, Observable<boolean | any[]>>;
@vsaw
vsaw / ubuntu-kernel-cleanup.sh
Last active September 10, 2021 21:33
Clean up old, unused Linux Kernel version in Ubuntu
#!/bin/bash
#
# Clean up old, unused Linux Kernel version in Ubuntu
# ===================================================
#
# My system keeps running out of space on the boot partition as Ubuntu Linux
# does not remove unused Kernel version on a Kernel update. This small script
# will remove them for you. It's insipired by
# http://tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/
#
@vsaw
vsaw / README.md
Created December 15, 2015 12:28
2015-12-15 Spam/Phishing Mail

I recently received a spam/phising Mail to my personal account. If anyone's interested in investigating here's what I got from it.

The original mail contained the following contents

Dear Client,

This e-mail is pursuant to your contract with Foreman&Clark Ltd. for our services date November 15, 2015 for the amount of $5,282. Your failure to pay as per the December 1, 2015 invoice equals to the breach of our contract.

Please, acknowledge the receipt of this e-mail within three business days. Please, make your payment to the corresponding account, stated in the invoice attached no later than January 2, 2016.

@vsaw
vsaw / gist:ee2a90065efa652a1927
Last active November 14, 2015 16:39
Ethics in agent based systems

Keybase proof

I hereby claim:

  • I am vsaw on github.
  • I am vsaw (https://keybase.io/vsaw) on keybase.
  • I have a public key whose fingerprint is 7ACA 2C01 7BB1 97C0 6C77 F77D FA20 0470 B801 7CCC

To claim this, I am signing this object:

@vsaw
vsaw / timestamp.sh
Last active December 21, 2015 01:39
Adds a timestamp to console output.To use just type: `cat /dev/ttyUSBn | timestamp.sh`
#!/bin/sh
# If Millisecond precision is required for the output uncomment the following
# line
#
# awk '{ system("date +%T.%N"); print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush(); }'
# Regular second precision timestamps
awk '{ print strftime("%Y-%m-%dT%H:%M:%S"), $0; fflush(); }'