Skip to content

Instantly share code, notes, and snippets.

Avatar
🧑‍💼
I am ready to be hired

Shahryar Tavakkoli shahryarjb

🧑‍💼
I am ready to be hired
View GitHub Profile
@shahryarjb
shahryarjb / json
Created Jan 30, 2022 — forked from akoutmos/json
Pretty print JSON passed via STDIN using Elixir shell script
View json
#! /usr/bin/env elixir
# Install required deps
Mix.install([:jason])
# The pretty printing module
defmodule JsonPrettyPrinter do
def get_stdin_data do
# Fetch data from STDIN and decode JSON
:stdio
View zarinpal_json_api.ex
defmodule BankError.Extera.BankProvider.Zarinpal do
def get_token(type) do
sms_body = Jason.encode!(
%{
"MerchantID" => "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Amount" => "1000",
"CallbackURL" => "https://YORSITE.com/back-pay/zarinpal",
"Description" => type
}
View states.ex
// in terminal
"[{\"name\":\"البرز\",\"state_code\":\"31\"},{\"name\":\"تهران\",\"state_code\":\"1\"},{\"name\":\"گيلان\",\"state_code\":\"2\"},{\"name\":\"آذربايجان شرقي\",\"state_code\":\"3\"},{\"name\":\"خوزستان\",\"state_code\":\"4\"},{\"name\":\"فارس\",\"state_code\":\"5\"},{\"name\":\"اصفهان\",\"state_code\":\"6\"},{\"name\":\"خراسان رضوي\",\"state_code\":\"7\"},{\"name\":\"قزوين\",\"state_code\":\"8\"},{\"name\":\"سمنان\",\"state_code\":\"9\"},{\"name\":\"قم\",\"state_code\":\"10\"},{\"name\":\"مركزي\",\"state_code\":\"11\"},{\"name\":\"زنجان\",\"state_code\":\"12\"},{\"name\":\"مازندران\",\"state_code\":\"13\"},{\"name\":\"گلستان\",\"state_code\":\"14\"},{\"name\":\"اردبيل\",\"state_code\":\"15\"},{\"name\":\"آذربايجان غربي\",\"state_code\":\"16\"},{\"name\":\"همدان\",\"state_code\":\"17\"},{\"name\":\"كردستان\",\"state_code\":\"18\"},{\"name\":\"كرمانشاه\",\"state_code\":\"19\"},{\"name\":\"لرستان\",\"state_code\":\"20\"},{\"name\":\"بوشهر\",\"state_code\":\"21\"},{\"name\":\"كرمان\",\"state_code\":\
View app.js
// We need to import the CSS so that webpack will load it.
// The MiniCssExtractPlugin is used to separate it out into
// its own CSS file.
import css from "../css/app.scss"
import "bootstrap"
// webpack automatically bundles all modules in your
// entry points. Those entry points can be configured
// in "webpack.config.js".
View per-invoice.html
<div class="d-block my-3">
<div class="custom-control custom-radio">
<input id="pishtaz" name="paymentMethod" type="radio" class="custom-control-input" required="">
<label class="custom-control-label shipping-select" for="pishtaz"> <i class="far fa-shipping-fast"></i> پست پیشتاز</label>
</div>
<div class="spacer10"> </div>
<div class="alert alert-info" role="alert">
پست پیشتاز حداکثر به مدت ۳ روز کاری برای شما ارسال می گردد
</div>
<div class="spacer20"> </div>
View allert.html
<div class="alert alert-primary" role="alert">
متن شما
</div>
<div class="alert alert-secondary" role="alert">
متن شما
</div>
<div class="alert alert-success" role="alert">
متن شما
</div>
<div class="alert alert-danger" role="alert">
View abtn.html
دکمه های داخل رنکی
<a href="link_shoma" class="btn btn-primary">Primary</a>
<a href="link_shoma" class="btn btn-secondary">Secondary</a>
<a href="link_shoma" class="btn btn-success">Success</a>
<a href="link_shoma" class="btn btn-danger">Danger</a>
<a href="link_shoma" class="btn btn-warning">Warning</a>
<a href="link_shoma" class="btn btn-info">Info</a>
<a href="link_shoma" class="btn btn-light">Light</a>
<a href="link_shoma" class="btn btn-dark">Dark</a>
View bazaar.ex
def test(user_purchases_token, access_token) do
HTTPoison.get("https://pardakht.cafebazaar.ir/devapi/v2/api/applications/com.bankerror/subscriptions/SignUp/purchases/#{user_purchases_token}?access_token=#{access_token}")
end
# back
%HTTPoison.Response{
body: "",
headers: [
{"Date", "Sun, 18 Aug 2019 08:32:59 GMT"},
{"Content-Type", "text/html; charset=utf-8"},
View all_systemctl
systemctl list-unit-files
UNIT FILE STATE
proc-sys-fs-binfmt_misc.automount static
-.mount generated
boot-efi.mount generated
dev-hugepages.mount static
dev-mqueue.mount static
proc-sys-fs-binfmt_misc.mount static
snap-core-6350.mount enabled
snap-gnome\x2d3\x2d26\x2d1604-74.mount enabled
View full_sys
Aug 5 12:54:56 reza-X45U rsyslogd: [origin software="rsyslogd" swVersion="8.32.0" x-pid="584" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
Aug 5 12:55:01 reza-X45U CRON[2150]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Aug 5 12:55:55 reza-X45U anacron[590]: Job `cron.daily' terminated
Aug 5 12:55:55 reza-X45U anacron[590]: Normal exit (1 job run)
Aug 5 13:00:32 reza-X45U systemd-resolved[473]: Grace period over, resuming full feature set (UDP+EDNS0) for DNS server 192.168.1.1.
Aug 5 13:00:34 reza-X45U /usr/lib/gdm3/gdm-x-session[1140]: (EE) event5 - ETPS/2 Elantech Touchpad: libinput bug: invalid tap event TAP_EVENT_PALM in state TAP_STATE_TAPPED
Aug 5 13:01:14 reza-X45U systemd-resolved[473]: Grace period over, resuming full feature set (UDP+EDNS0) for DNS server fe80::1%3.
Aug 5 13:01:14 reza-X45U systemd-resolved[473]: Using degraded feature set (UDP) for DNS server fe80::1%3.
Aug 5 13:01:15 reza-X45U systemd-resolved[473]: Server returned error NXDOMAIN, mitigating