Skip to content

Instantly share code, notes, and snippets.

View mhf-ir's full-sized avatar

Mohammad Hossein Fattahizadeh mhf-ir

View GitHub Profile
@mhf-ir
mhf-ir / mimetype-extension-map.tsv
Last active January 6, 2022 14:06
mimetype extension map
MIMETYPE extension
application/andrew-inset ez
application/applixware aw
application/atom+xml atom
application/atomcat+xml atomcat
application/atomsvc+xml atomsvc
application/ccxml+xml ccxml
application/cdmi-capability cdmia
application/cdmi-container cdmic
application/cdmi-domain cdmid
@mhf-ir
mhf-ir / compare.md
Last active January 6, 2022 13:49
Compare different mimetype detector
Path Valid Reference File Perl Go
3mf.3mf 🔎 application/vnd.ms-package.3dmanufacturing-3dmodel+xml https://en.wikipedia.org/wiki/3D_Manufacturing_Format text/xml application/xml application/vnd.ms-package.3dmanufacturing-3dmodel+xml
aac.aac 🔎 audio/aac https://en.wikipedia.org/wiki/Advanced_Audio_Coding audio/x-hx-aac-adts audio/aac audio/aac
aaf.aaf 🔎 application/cdfv2 application/x-ole-storage application/octet-stream
accdb.accdb 🔎 application/x-msaccess application/octet-stream application/x-msaccess
aiff.aiff 🔎 audio/x-aiff audio/x-aiff audio/aiff
amf.amf [🔎
document.write('<style>.sample-class { color: red; }</style>');
document.write('<p class="sample-class">this must be printed and red</p>');
@mhf-ir
mhf-ir / openssl-digest-algorithms.sh
Created September 19, 2020 07:25
openssl digest algorithms with length
#!/bin/bash
openssl list -digest-algorithms | while read line
do
ALG=$(echo $line | awk '{ print $1 }')
echo $ALG
RES=$(echo "1" | openssl $ALG | awk '{print $NF}')
echo $RES
echo "size is ${#RES}"
echo "====="
@mhf-ir
mhf-ir / alpha_persian_fixer.php
Last active August 17, 2020 08:19
alpha_persian_fixer
<?php
// Characters added via ICU
// https://github.com/unicode-cldr/cldr-misc-modern/blob/master/main/fa/characters.json#L10
//
// must be duplicate
$a = "
آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهیآابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی
";

Sample markdown test

My name is Muhammad Hussein fattahizadeh my website is mhf.ir

@mhf-ir
mhf-ir / log
Last active February 7, 2020 11:06
{"level":"debug","ts":1581072117.4029663,"msg":"logLevel set to debug"}
{"level":"warn","ts":1581072117.4030857,"msg":"generating random session.key"}
{"level":"info","ts":1581072117.4031963,"msg":"configuring ADFS OAuth"}
{"level":"info","ts":1581072117.4032087,"msg":"configuring adfs OAuth with Endpoint https://adfs.example.tld/adfs/oauth2/authorize/"}
{"level":"debug","ts":1581072117.4032269,"msg":"vouch.jwt.secret is 44 characters long"}
{"level":"debug","ts":1581072117.403232,"msg":"vouch.session.key is 44 characters long"}
{"level":"debug","ts":1581072117.403245,"msg":"checking availability of tcp port: 0.0.0.0:19090"}
{"level":"debug","ts":1581072117.4112332,"msg":"viper settings map[vouch:map[db:map[file:/db/vouch_bolt.db] loglevel:debug headers:map[jwt:X-Vouch-Token querystring:access_token redirect:X-Vouch-Requested-URI idtoken:X-Vouch-IdP-IdToken] port:19090 cookie:map[name:VouchCookie domain:example.tld secure:false] allowallusers:true listen:0.0.0.0 jwt:map[secret:54V2jDpTQs7AfaoNOI/6J7quwyIvGLn4
@mhf-ir
mhf-ir / config.yml
Last active February 6, 2020 16:32
Vouch proxy ADFS
vouch:
logLevel: debug
testing: true
listen: 0.0.0.0
port: 19090
AllowAllUsers: true
domains:
- example.tld
- app.example.tld
- vouch.example.tld
@mhf-ir
mhf-ir / iranianIdentityCardValidation.js
Last active September 1, 2020 03:26
اعتبار سنجی کد ملی ایرانی - Iranian identity card validation
/**
* Iranian identity card validation
* اعتبار سنجی کد ملی ایرانی
*
* @param {string|integer} value
* @returns {boolean}
*/
const iranianIdentityCardValidation = (value) => {
if (typeof value === 'undefined' || !value) {
return false;
@mhf-ir
mhf-ir / mdjson.json
Created July 27, 2019 16:00
sample mdjson
{
"personalities": [
"raid1",
"raid0",
"linear",
"multipath",
"raid6",
"raid5",
"raid4",
"raid10"