Skip to content

Instantly share code, notes, and snippets.

View mohammedmatar's full-sized avatar
🤾‍♂️
Only one who wanders finds new paths.

❁ Mohammed Matar ❁ mohammedmatar

🤾‍♂️
Only one who wanders finds new paths.
View GitHub Profile
@mohammedmatar
mohammedmatar / cloudSettings
Created September 9, 2017 21:08
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-09-09T21:07:51.699Z","extensionVersion":"v2.8.3"}
@mohammedmatar
mohammedmatar / RoleGuard.ts
Created March 24, 2018 08:48
Angular5 - role guard
import { Injectable } from '@angular/core';
import {CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router} from '@angular/router';
import { Observable } from 'rxjs/Observable';
import {tap} from 'rxjs/operators/tap';
import {UsersDsService} from '../data-source/users-ds.service';
@Injectable()
export class RoleGuard implements CanActivate {
constructor( private router: Router, private userDS: UsersDsService) {}
canActivate(
@mohammedmatar
mohammedmatar / AuthGuard.ts
Created March 24, 2018 08:55
Angular 5 - AuthGuard with
import { Injectable } from '@angular/core';
import {CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router} from '@angular/router';
import { Observable } from 'rxjs/Observable';
import {NbAuthService} from '@nebular/auth';
import { tap } from 'rxjs/operators/tap';
import 'rxjs/add/operator/mergeMap';
import {UsersDsService} from '../data-source/users-ds.service';
@Injectable()
export class AuthGuard implements CanActivate {
@mohammedmatar
mohammedmatar / linux-power-management
Created July 2, 2018 23:37
Power management configs for Arch Linux (without laptop-mode-tools, powertop, etc)
## Preamble
There are lots of tools out there that set power management, some more transparent (powertop), some less so (laptop-mode). Often it is hard to know what exactly the tool is doing to improvement power management. Here I would like to document some of the things I do to improve power efficiency and sometimes performance as well.
/etc/sysctl.d/99-sysctl.conf
> # To fix Dropbox not being able to handle too many files
> fs.inotify.max_user_watches = 524288
>
> # VM writeback timeout (suggestion from powertop: In hundredths of a second, this is how often pdflush wakes up to write data to disk.)
> vm.dirty_writeback_centisecs = 1500
openapi: 3.0.0
servers:
- url: 'http://petstore.swagger.io/v3'
info:
description: >-
Flight Module helps control the process of bookings for customers regardless
of direct customers
* [The traveler himself] or an indirect agent [as a broker or representative to enable the booking of passengers and take a percentage about it]
* In the form input called the company beneficiary
* To complete the process of booking a flight ticket requires the existence of some basic data for booking
@mohammedmatar
mohammedmatar / .htaccess
Created May 27, 2019 03:31
the only fucking working configuration to handle 404 error when deploying angular to apache, because there when you using angular router and you dont want to enable Hash Strategy you have to create .htaccess and add this fucking code to, plus if you have a ci, you will need to add .htaccess to be copied to the root directory.
<IfModule mod_rewrite.c>
Options Indexes FollowSymLinks
RewriteEngine On
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
@mohammedmatar
mohammedmatar / pluralsight-downloader.sh
Created July 24, 2019 10:40
export username [ PL_USER=your_email] & password [PL_PASS=your_password], make the script executable chmod +x ./pluralsight-downloader.sh and run the sciprt ./pluralsight-downloader.sh "course url"
#!/bin/bash
youtube-dl --username $PL_USER --password $PL_PASS -o "./%(playlist)s/%(chapter_number)s - %(chapter)s/%(playlist_index)s - %(title)s.%(ext)s" --verbose --min-sleep-interval 30 --max-sleep-interval 60 "$1" --playlist-start 1
/* Base */
/* APP SCSS */
/*Typography*/
/*Colors*/
html, body {
font-family: 'NeueFrutigerWorld',sans-serif !important;
font-weight: lighter;
font-size: 12px;
height: 100%;
position: relative;
@mohammedmatar
mohammedmatar / README.md
Created April 18, 2020 03:58 — forked from twolfson/README.md
Script to upload images to Imgur via curl

With visual testing we occasionally need to debug images in CI environments. We were previously using Imgur's v1 API:

https://github.com/twolfson/twolfson.com/blob/3.102.0/test/perceptual-tests/upload-screenshots.sh

but that's been shutdown and v2 and v3 seems like they need login for uploading images. We don't like that since these are rarely setup and we don't want to associate development content with personal content.

Thankfully Imgur supports uploading images via the browser without logging in. After trial/error, we got the following script for uploading a single image:

#!/usr/bin/env bash
@mohammedmatar
mohammedmatar / compress.js
Created September 1, 2020 12:57 — forked from aldo-roman/compress.js
Brotli compression with Angular CLI
const brotli = require('brotli')
const fs = require('fs')
const brotliSettings = {
extension: 'br',
skipLarger: true,
mode: 1, // 0 = generic, 1 = text, 2 = font (WOFF2)
quality: 10, // 0 - 11,
lgwin: 12 // default
}