Skip to content

Instantly share code, notes, and snippets.

View arastu's full-sized avatar

Touhid Arastu arastu

View GitHub Profile
# Iran adlist
# source:
# Get current status of a OpenFortiVPN connection with options to connect/disconnect.
# Commands that require admin permissions should be whitelisted with 'visudo', e.g.:
# YOURUSERNAME ALL=(ALL) NOPASSWD: /usr/local/bin/openfortivpn
# YOURUSERNAME ALL=(ALL) NOPASSWD: /usr/bin/killall -2 openfortivpn
# To use openfortivpn in an easy way you can create file like: /Documents/.fortivpn-config and put your crential in it as following:
# host=123.45.678.9
# port=1234
$ brew list
==> Formulae
ali gnu-sed libogg mitmproxy recode
aom gnupg libpng mpdecimal rtmpdump
apr gnutls libpq mpfr rubberband
apr-util go libpthread-stubs mpv ruby
argon2 gobject-introspection librist msgpack sdl2
asdf graphite2 librsvg mujs sheldon
aspell graphviz libsamplerate mutagen six
autoconf grep libsndfile ncurses snappy
arastu / q.ts
Last active March 6, 2022 06:39
Simple Queue data structure in TypeScript
class Queue<T> {
private list: T[] = [];
private readonly capacity: number | null = null;
private tail = 0;
private head = 0;
constructor(capacity: number) {
this.capacity = Math.max(capacity, 0) || null;
if (this.capacity) {
arastu / server.js
Created August 21, 2021 18:32
Node.js http server with random responses time for testing purposes
const http = require('http');
function randomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
function randomIDGenerator(length) {
arastu /
Created May 4, 2021 13:51
Write rtl (Persian, Arabic, Hebrew) text on images using python and pillow
# First of all you need install *libraqm* on your machin.
# The Raqm library encapsulates the logic for complex text layouts and provides a convenient API.
# libraqm relies on the following libraries: FreeType, HarfBuzz, FriBiDi,
# make sure that you install them before installing libraqm if not available as package in your system.
# if you using macos you can install libraqm with homebrew
# $> brew install libraqm
# Pillow wheels since version 8.2.0 include a modified version of libraqm
arastu /
Created April 10, 2021 07:06 — forked from jacklinke/
Django models cheatsheet
import uuid
from django.db import models
# Use the import below instead, if using GeoDjango fields
# from django.contrib.gis.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.postgres.fields import (
arastu / current_track.applescript
Last active November 27, 2020 19:52
update twitter bio and add current playing song from Spotify to it
on escape_quotes(string_to_escape)
set AppleScript's text item delimiters to the "\""
set the item_list to every text item of string_to_escape
set AppleScript's text item delimiters to the "\\\""
set string_to_escape to the item_list as string
set AppleScript's text item delimiters to ""
return string_to_escape
end escape_quotes
tell application "Spotify"

Keybase proof

I hereby claim:

  • I am arastu on github.
  • I am arastu ( on keybase.
  • I have a public key ASDTglyFyGlXVmDMsuusGrWei9GdBSrTBa3JSJ-Y5PN3HQo

To claim this, I am signing this object:

arastu / airpods-toggle.applescript
Last active March 29, 2021 08:47
Connect/disconnect AirPods automatically on Mac
-- Forked from:
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth")
tell btMenu
tell (menu item "PUT_YOUR_AIRPODE_NAME_HERE" of menu 1) -- Touhid’s AirPods not Touhid's AirPods
if exists menu item "Connect" of menu 1 then