Skip to content

Instantly share code, notes, and snippets.

View khooz's full-sized avatar

Mustafa Talaeezadeh Khouzani khooz

View GitHub Profile
@khooz
khooz / iranian-banks-bin.json
Created October 9, 2023 09:30 — forked from ahbanavi/iranian-banks-bin.json
Iranian banks cart number bin
[
{
"bank": "markazi",
"title": "اداره معاملات ریالی بانک مرکزی",
"bin": "636795"
},
{
"bank": "sanat",
"title": "بانک صنعت و معدن",
"bin": "627961"
@khooz
khooz / gen-certs-helper.sh
Last active May 7, 2022 10:26
OLCNE certificate generator helper
#!/bin/bash -e
#
# Copyright (c) 2019-2021 Oracle and/or its affiliates. All rights reserved.
# Licensed under the GNU General Public License Version 3 as shown at https://www.gnu.org/licenses/gpl-3.0.txt.
# This script is made to generate certificates to run the olcne control plane (agent, api-server and cli)
# See the help text for more information
# User inputs that can be modified by the CLI
DEBUG="false"
@khooz
khooz / js-only-age-restriction.js
Created September 29, 2021 08:52
Simple age restriction guard that only relies on js-cookie.
// Make sure js-cookies are loaded before this code
function verifyAge(gaurdingPage = "./age-verification.html") {
if (!Cookies.get("age-verification"))
{
Cookies.set("intended", window.location.href);
window.location.replace(gaurdingPage);
}
}
function checkAge(homePage = "./index.html", awayPage = "https://www.google.com/?q=") {
@khooz
khooz / google_eng_example.php
Last active December 29, 2016 16:57
Here's a more complete solution for Google's Example Coding/Engineering Interview video at https://youtu.be/XKu_SEDAykw
<?php
// PHP ^7.1
$ar1 = [1,2,5,9,-1,3,4,5]; // test array #1
$ar2 = [1,2,4,4,9,3,4,5,3]; // test array #2
/**
* Function that finds indices of x-complements to an element in an array
*
* @param array arr an array of integer/float numbers
* @param int sum the base for complements
@khooz
khooz / persian_date_time.regex
Created November 29, 2015 19:16
PCRE compatible regex tester for Persian date-time. It differs from Gregorian and Julian in the way that the first 6 months of the year (spring and summer) has 31 days in and the other 6 (autumn and winter) has 30 days. The last month of winter (Esfand) has a leap day every four years and this is accounted in this regex. The seconds does not cou…
(?(DEFINE)(?<delim_date>\/)(?<delim_time>:)(?<delim_datetime>-)(?<delim_fractime>\.)(?<delim_ampm> ))^(?:\d{4}(?&delim_date)(?:0*[1-6](?&delim_date)0*(?:[1-9]|[1-2]\d|3[01])|0*(?:[7-9]|1[01])(?&delim_date)0*(?:[1-9]|[1-2]\d|30))|\d{4}(?&delim_date)0*12(?&delim_date)0*(?:[1-9]|[1-2]\d)|\d{2}(?:[02468][37]|[13579][159])(?&delim_date)0*12(?&delim_date)0*30)(?:(?&delim_datetime)(?:0*(?:\d|1\d|2[0-3])(?&delim_time)0*(?:\d|[1-5]\d)(?&delim_time)0*(?:\d|[1-5]\d)(?:(?&delim_fractime)\d+)?(?!(?&delim_ampm)(?i)(?:AM|PM)(?-i))|0*(?:\d|1[0-2])(?&delim_time)0*(?:\d|[1-5]\d)(?&delim_time)0*(?:\d|[1-5]\d)(?:(?&delim_fractime)\d+)?(?&delim_ampm)(?i)(?:AM|PM)(?-i)))?$
@khooz
khooz / composer.json
Created August 24, 2014 12:18
A useful list of required and required-dev packages for a Laravel 4.2+ project php 5.5+
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require-dev": {
"way/generators": "2.*",
"codeception/codeception": "*",
"barryvdh/laravel-debugbar": "1.*",
"barryvdh/laravel-ide-helper": "1.*",