Skip to content

Instantly share code, notes, and snippets.

View HamedFathi's full-sized avatar
🌎

Hamed Fathi HamedFathi

🌎
View GitHub Profile
@HamedFathi
HamedFathi / download-install-wsl-linux.txt
Created December 6, 2023 08:30 — forked from vheidari/download-install-wsl-linux.txt
how to download and install manually wsl2, and linux distor on windows
Manually download Windows Subsystem for Linux distro packages:
# @link: https://docs.microsoft.com/en-us/windows/wsl/install-manual#installing-your-distro
Windows Subsystem for Linux Installation Guide for Windows 10:
# @link: https://docs.microsoft.com/en-us/windows/wsl/install-win10#set-your-distribution-version-to-wsl-1-or-wsl-2
Updating Wsl :
Download Msi Wsl update package from below link then install it :
@link : https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
class PathMe {
moves: string[] = [];
constructor() {
this.moves = [];
return this;
}
moveTo(x: number, y: number) {
@HamedFathi
HamedFathi / readme.md
Created July 20, 2023 14:19 — forked from primaryobjects/readme.md
How to Configure AutoGPT with Azure OpenAI Active Directory Managed Identity

How to Configure AutoGPT with Azure OpenAI Active Directory Managed Identity

AutoGPT is an extension of ChatGPT to automatically run an agent to complete a solution without human intervention.

Normally, an OpenAI API key is used.

For Azure OpenAI, you must use either an API token or an Azure Active Directory account.

Loading an API Key with Azure Managed Identity

@HamedFathi
HamedFathi / Program.cs
Created April 27, 2023 10:21 — forked from ErikNoren/Program.cs
ASP.NET Core 6 configuration settings stored in a SQL database and acts just like appsettings.json
//Snippet from Program.cs which adds the provider and sets up a Settings class to map the settings
using ErikNoren.Configuration;
using TestMvcWebApplication;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddSqlDatabase(config =>
{
//We can get the connection string from previously added ConfigurationProviders to use in setting this up
config.ConnectionString = builder.Configuration.GetConnectionString("DemoDatabase");
import { Browser, chromium, firefox, webkit } from "playwright";
import { afterAll, beforeAll, describe, it } from "vitest";
const browserTypes = process.env.ALL_BROWSERS
? [chromium, firefox, webkit]
: [chromium];
for (const browserType of browserTypes) {
describe(`browser:${browserType.name()}`, () => {
let browser: Browser;
@HamedFathi
HamedFathi / options-in-typescript.ts
Created February 18, 2023 10:20 — forked from bcherny/options-in-typescript.ts
Options in TypeScript
type None = {
flatMap<U>(f: (value: null) => Option<U>): None
getOrElse<U>(def: U): U
isEmpty(): true
map<U>(f: (value: null) => U): None
nonEmpty(): false
orElse<U>(alternative: Option<U>): Option<U>
}
type Some<T> = {
@HamedFathi
HamedFathi / Option.ts
Created February 18, 2023 10:20 — forked from bcherny/Option.ts
Options in TypeScript!
// @see http://www.scala-lang.org/api/2.7.4/scala/Option.html
class Opt<A> {
value: A | null
// TODO: use constructor fn instead
static from<A>(value: A | null): Opt<A> {
return value == null ? None : Some(value)
}
@HamedFathi
HamedFathi / ngpurge.js
Created February 11, 2023 09:15 — forked from brianroadifer/ngpurge.js
Angular PurgeCSS Script
// orignal author @dylanvdmerwe - https://dev.to/dylanvdmerwe/reduce-angular-style-size-using-purgecss-to-remove-unused-styles-3b2k
const exec = require("child_process").exec;
const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
function removeUnusedCSS() {
var pathPrefix = process.argv.slice(2)[0];
// find the styles css file
const files = getAllFiles(`./${pathPrefix}/`, ".css");
/* Attribution: http://techslides.com/how-to-parse-and-search-json-in-javascript */
//return an array of objects according to key, value, or key and value matching
function getObjects(obj, key, val) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
objects = objects.concat(getObjects(obj[i], key, val));
} else
@HamedFathi
HamedFathi / index.html
Created December 2, 2021 22:57 — forked from LucGranato/index.html
Monaco Editor Liquid Language
<div id="container" style="height:100%;"></div>