This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# calculate check digit for a UPC-A barcode | |
Code ← [1 2 3 4 5 6 7 8 9 0 1] | |
Coeffs ← +1 ×2 ◿2 +1 ⇡ ⧻ Code | |
Check ← ⌵ -10 ◿10 /+ × Code Coeffs | |
Final ← ⊂ Code Check | |
Code | |
Coeffs | |
Check | |
Final |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LOC="/etc/resolvconf/resolv.conf.d/head" | |
if [[ $1 = "remove" ]]; then | |
echo "nameserver 1.1.1.1" | sudo tee $LOC | |
elif [[ $1 = "begzar" ]]; then # begzar.ir | |
echo "nameserver 185.55.226.26" | sudo tee $LOC | |
echo "nameserver 185.55.225.25" | sudo tee -a $LOC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## originally writeen for brother Omar. thanks to: | |
## https://github.com/nramos0/binhex4-rs/ | |
## https://gist.github.com/i-e-b/fe0a0158ae61973802a9 | |
import std/[strutils, sequtils, os] | |
type | |
DecodedHqxContent = distinct string | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std/macros | |
import macroplus | |
# ----- impl | |
template emp: untyped = newEmptyNode() | |
func resolveParams(rawParams: openArray[NimNode]): seq[NimNode] = | |
template init = | |
result.add newNimNode nnkIdentDefs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std/strutils | |
type BookFeatures = enum | |
bfIntroAndDownload = "معرفی و دانلود" | |
bfIntroAndPurchase = "معرفی، خرید و دانلود" | |
bfFreeContent = "رایگان" | |
bfBook = "کتاب" | |
bfAudioBook = "کتاب صوتی" | |
bfPodcast = "پادکست" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std/[strformat, strutils] | |
import sbttl | |
# ------------------------ | |
type | |
Lang = enum | |
fa, en | |
Dir = enum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import telebot, asyncdispatch, logging, options | |
var L = newConsoleLogger(fmtStr = "$levelname, [$time] ") | |
addHandler(L) | |
func singleReply*(btn: KeyboardButton): ReplyKeyboardMarkup = | |
ReplyKeyboardMarkup(`type`: kReplyKeyboardMarkup, keyboard: @[@[btn]]) | |
const API_KEY = "..." |