Skip to content

Instantly share code, notes, and snippets.

View kousherAlam's full-sized avatar
💭
I may be slow to respond..

Kousher alam kousherAlam

💭
I may be slow to respond..
View GitHub Profile
@kousherAlam
kousherAlam / .htaccess
Created March 31, 2017 10:00
CI: Simple .htaccess using mod_rewrite for CodeIgniter
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
@kousherAlam
kousherAlam / server.js
Last active September 9, 2023 13:43
This is a basic node js server, serve the web page,font ,image and video from public folder...
const http = require("http"),
fs = require("fs"),
path = require("path"),
log = console.log;
//this will response with file type with specifiq content and encode
function response(res, file, contentType, encode) {
if (file != "404") {
res.writeHead(200, { "Content-type": contentType });
if (encode) {
function check(numbers:number[], value: number): number[] {
const needMap:any = {};
const result: number[] = [];
let round = 0;
numbers.every((n, index) => {
round ++;
if(needMap[n] > -1) {
result.push(...[numbers[needMap[n]], n]);
@kousherAlam
kousherAlam / ubuntu-desktop-entry.md
Last active December 18, 2021 06:37
Creating desktop entry on ubuntu

Creating desktop entry

$ touch /usr/share/applications/robomongo.desktop

Edit

$ vim /usr/share/applications/robomongo.desktop
@kousherAlam
kousherAlam / robo3t-ubuntu-installation.md
Last active December 18, 2021 06:35
Install robo3t on ubuntu

This document copied from https://gist.github.com/abdallahokasha/37911a64ad289487387e2d1a144604ae here.

Install Robo3t On Ubuntu 18.04

Download the package form Robo3t or using wget
@kousherAlam
kousherAlam / aws_force_mfa.json
Created November 27, 2021 14:50
force aws iam account to use mfa
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowViewAccountInfo",
"Effect": "Allow",
"Action": [
"iam:GetAccountPasswordPolicy",
"iam:GetAccountSummary",
"iam:ListVirtualMFADevices",
import { Observable, Subject, from, throwError } from 'rxjs';
import { map, catchError, tap, switchMap } from 'rxjs/operators';
import { Injectable } from '@angular/core';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { AuthService } from 'ngx-auth';
import { TokenStorage } from './token-storage.service';
import { UtilsService } from '../services/utils.service';
import { AccessData } from './access-data';
import { Credential } from './credential';
@kousherAlam
kousherAlam / token-interceptor.service.ts
Created April 13, 2020 18:08 — forked from abereghici/token-interceptor.service.ts
Angular Tutorial — Implement Refresh Token with HttpInterceptor
// src/app/services/token-interceptor.service.ts
import { Injectable } from "@angular/core";
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from "@angular/common/http";
import { AuthenticationService } from "../authentication.service";
import { Observable } from "rxjs/Observable";
import { BehaviorSubject } from "rxjs/BehaviorSubject";
@Injectable()
export class RefreshTokenInterceptor implements HttpInterceptor {
@kousherAlam
kousherAlam / .block
Last active July 2, 2019 05:15
d3-test-01
license: mit
import { Request, Response } from "express";
import { successResponse } from "../../Helpers/Responses/successResponse";
import { ApiConfig } from "../../Configs/Api.Config";
import { errorResponse } from "../../Helpers/Responses";
const { OAuth2Client } = require("google-auth-library");
const { google } = require("googleapis");
export default async function googleLogin(request: Request, response: Response) {
console.log(ApiConfig.THIRD_PARTY_LOGIN_API.GOOGLE.SCOPES);