Skip to content

Instantly share code, notes, and snippets.

View mhf-ir's full-sized avatar

Mohammad Hossein Fattahizadeh mhf-ir

View GitHub Profile
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"
@mhf-ir
mhf-ir / chaser.md
Last active September 26, 2018 13:46
@mhf-ir
mhf-ir / sheba.js
Created November 24, 2017 09:48
iranian sheba bank validation javascript | اعتبار سنجی کد شبا با جاوا اسکریپت
function iso7064Mod97_10(iban) {
var remainder = iban,
block;
while (remainder.length > 2){
block = remainder.slice(0, 9);
remainder = parseInt(block, 10) % 97 + remainder.slice(block.length);
}
return parseInt(remainder, 10) % 97;