Skip to content

Instantly share code, notes, and snippets.

View itshaadi's full-sized avatar

Hadi Azami itshaadi

View GitHub Profile
@itshaadi
itshaadi / executor.ts
Created January 7, 2021 21:37
Definition of a pipeline executor
class PipelineExecutor {
private headOfExecutionChain: ExecutionUnit;
constructor(units: ExecutionUnit[]) {
const totalUnits = units.length;
for (let i = 0; i <= totalUnits; i++) {
if (i < totalUnits - 1) {
units[i].setNext(units[i + 1]);
}
}
@itshaadi
itshaadi / canPanic.ts
Created January 7, 2021 21:03
Definition of an execution unit that can panic
class CanPanic implements ExecutionUnit {
next: ExecutionUnit | null;
pipeline: IAPPipeline;
constructor(pipeline: IAPPipeline) {
this.next = null;
this.pipeline = pipeline;
}
setNext(next: ExecutionUnit): void {
this.next = next;
@itshaadi
itshaadi / canFail.ts
Created January 7, 2021 20:49
Definition of an execution unit that can fail
class CanFail implements ExecutionUnit {
next: ExecutionUnit | null;
pipeline: IAPPipeline;
constructor(pipeline: IAPPipeline) {
this.next = null;
this.pipeline = pipeline;
}
setNext(next: ExecutionUnit): void {
this.next = next;
}
@itshaadi
itshaadi / README.md
Last active January 20, 2021 11:55
GeoIP no-route

Usage

this script will generate routing files for ocserv and iproute2 based on MaxMind's GeoLite2

usage: generate.py [-h] [-i] [-g] [-cc]

optional arguments:
  -h, --help  show this help message and exit
  -i          CSV Dir
@itshaadi
itshaadi / myirancell-demo.py
Created May 6, 2020 23:57
دریافت کارکرد حساب ایرانسل من
import requests
from lxml import html
USERNAME = "<username>"
PASSWORD = "<password>"
LOGIN_URL = "https://my.irancell.ir/api/verifyecarepass"
CSRF_URL = "https://my.irancell.ir/"
URL = "https://my.irancell.ir/api/myaccounts_test"
@itshaadi
itshaadi / e3372_reboot.abs
Created April 13, 2020 22:50
huawei e3372 (vendorlock version MCI/IRANCELL)
#!/bin/abs
# requires https://www.abs-lang.org/
gateway = "http://192.168.8.1"
token_uri = "/api/webserver/token"
reboot_uri = "/api/device/control"
f get(uri) {
cmd = `curl -s -X GET ${gateway}${uri}`
return cmd
@itshaadi
itshaadi / AdGuardHome.txt
Last active March 13, 2022 17:42
لیست سرویس های تبلیغاتی ایران
||yektanet.com^
||popfa.ir^
||mediaad.org^
||tapsell.ir^
||popupme.net^
||kaprila.com^
||popupplus.ir^
||amarfa.ir^
||adro.co^
||adtube.ir^
@itshaadi
itshaadi / index.py
Created March 22, 2018 13:32
webRTC MediaRecorder Sample
import os
import ffmpy
from flask import Flask, render_template, request, redirect, url_for, flash, send_from_directory, current_app
from werkzeug.utils import secure_filename
from flask_cors import CORS
UPLOAD_FOLDER = './uploads'
ALLOWED_EXTENSIONS = set(['ogg'])
app = Flask(__name__)
@itshaadi
itshaadi / vlcStream.bat
Created March 17, 2018 13:38
Streaming System Sound With VLC
@echo off
set vlc="C:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
start "" %vlc% --qt-start-minimized dshow:// :dshow-vdev=none :dshow-adev="Stereo Mix (Realtek High Definition Audio)" :live-caching=10 :sout=#transcode{vcodec=none,acodec=vorb,ab=500,channels=2,samplerate=44100}:http{dst=:8080/audiostream.ogg} :sout-keep:dshow
@itshaadi
itshaadi / cec-keypresses.sh
Last active March 9, 2018 18:35 — forked from bahamas10/cec-keypresses.sh
use `cec-client` to fire events when keys are pressed
#!/usr/bin/env bash
#
# react to cec keypresses in the jankiest way possible
#
# Author: Dave Eddy <dave@daveeddy.com>
# Date: 10/15/2013
# Licens: MIT
# Tested on: Raspberry pi with libcec compiled from soure
onright() {