Skip to content

Instantly share code, notes, and snippets.

View margani's full-sized avatar
🌍
Happy!

Hossein Margani margani

🌍
Happy!
View GitHub Profile
@margani
margani / node-typescript-esm.md
Created November 21, 2023 16:29 — forked from khalidx/node-typescript-esm.md
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@margani
margani / linux-font-config.md
Created October 28, 2023 16:49 — forked from morealaz/linux-font-config.md
تنظیمات فونت لینوکس

تنظیمات فونت لینوکس

مقدمه

تنظیمات فونت در لینوکس بر عهده برنامه fontconfig میباشد. این برنامه فونتهای سیستم را بر اساس الویت بندیهایی که قابل تنظیم میباشد مرتب میکند و در اختیار سایر برنامه ها قرار می دهد. مشکل اصلی که اکثر کاربران فارسی زبان لینوکس در ارتباط با fontconfig دارند عدم نمایش صحیح حروف فارسی می باشد که معمولا به دو دلیل زیر اتفاق می‌افتد:

  • نصب نبودن فونت مناسب بر روی سیستم که حروف فارسی را ساپورت کند
  • عدم وجود فایل تنظیمات fontconfig برای انتخاب فونت مناسب برای نمایش حروف فارسی
@margani
margani / async.js
Created December 6, 2021 05:41
Top-level async function that never rejects #js #async
(async () => {
try {
var text = await main();
console.log(text);
} catch (e) {
// Deal with the fact the chain failed
}
})();
@margani
margani / catch-error.js
Last active December 6, 2021 05:44
Axios api requests #axios #js
const response = await axios.get(url).catch((error) => error.response);
console.log({ response });
@margani
margani / restore_last_git_modified_time.sh
Last active December 6, 2021 05:22 — forked from HackingGate/restore_last_git_modified_time.sh
Retrieve and set the last modification date of all files in a git repository. Solution for https://stackoverflow.com/a/55609950/4063462 #git #date
#!/bin/sh -e
OS=${OS:-`uname`}
if [ "$OS" = 'Darwin' ]; then
get_touch_time() {
date -r ${unixtime} +'%Y%m%d%H%M.%S'
}
else
# default Linux
@margani
margani / Toggle-VNet-Route-All.ps1
Last active December 6, 2021 05:24
This gist has commands to enable/disable --vnet-route-all-enabled config in function apps #azure #functionapps #vnet
$subscriptionName = "<Your Subscription>"
$searchFunctionAppName = "<Your Search Name>"
$enableRouteAll = "false"
az login
az account set -s $subscriptionName
# Getting the status of the config
az functionapp list --query "[?contains(name, '$searchFunctionAppName')].{Name: name, RG: resourceGroup}" | ConvertFrom-Json | ForEach-Object { az functionapp config show -n $_.Name -g $_.RG --query vnetRouteAllEnabled }
@margani
margani / markdown-styles.css
Last active December 6, 2021 05:26
VS Code Markdown Styles #vscode #markdown #css
body {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
line-height: 1.5;
color: #24292e;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 16px;
line-height: 1.5;
word-wrap: break-word;
}
@margani
margani / index.html
Created March 25, 2020 10:21
Page with JavaScript refresh timer
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Down For Maintenance</title>
<style>
body { background: #fff; font-family: Helvetica,Arial,sans-serif; margin: 0; padding: 0; }
img { border: 0; }
.wrapper { width: 500px; margin: 0 auto; }
@margani
margani / w3wp-app-pools.cmd
Created January 8, 2020 09:35
Which w3wp.exe PID corresponds to which application pool ?
# https://docs.microsoft.com/en-us/archive/blogs/friis/which-w3wp-exe-pid-corresponds-to-which-application-pool
C:\Windows\System32\inetsrv\appcmd list wp
$env:HOME=$env:HOMESHARE
if ((Test-Path $env:HOME) -and (!($env:HOME.contains(':')))){
$DriveLetter = $env:HOMEDRIVE.replace(':','')
New-PSDrive -Name $DriveLetter -PSProvider FileSystem -Root $($env:HOMESHARE) | out-null
}
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {