Skip to content

Instantly share code, notes, and snippets.

View ParsaAlizadeh's full-sized avatar

Parsa Alizadeh ParsaAlizadeh

  • Tehran, Iran
View GitHub Profile
@ParsaAlizadeh
ParsaAlizadeh / dtmf.py
Created July 15, 2020 14:26
This code will recognize the pressed key on the phone by the sound of key.
from threading import Thread
import numpy as np
import sounddevice as sd
import time, pygame
from pygame.locals import *
pygame.init()
def listen():
global data, ind
stream = sd.InputStream(samplerate=rate, channels=1, dtype=np.int16)
@ParsaAlizadeh
ParsaAlizadeh / emote_to_sticker.sh
Last active July 11, 2021 15:04
Convert discord emotes to tiny telegram stickers
#! /bin/bash
# Use this script to convert discord emotes to tiny stickers in telegram
# Example package: https://t.me/addstickers/emotepk
for f in *.png; do
name=${f%.png}
convert $f -resize '512x256' -background none -extent '512x256' $name.out.png
done
@ParsaAlizadeh
ParsaAlizadeh / double-vpn.sh
Created September 18, 2021 10:54
Start a VPN over another VPN in NetworkManager
#!/bin/bash
C1="first vpn connection"
C2="second vpn connection"
on() {
nmcli con up $C1
nmcli con up $C2 ifname tun0
sudo nmcli con mod tun0 ipv4.never-default true
sudo nmcli con reload
@ParsaAlizadeh
ParsaAlizadeh / segment-lens.hs
Created January 7, 2022 14:25
Segment tree with appropriate lenses
{-# LANGUAGE
ScopedTypeVariables,
Rank2Types,
TemplateHaskell,
NoMonomorphismRestriction
#-}
module Data.SegmentTree.Lens
( Segment
, cnt, middle, value
@ParsaAlizadeh
ParsaAlizadeh / lier.hs
Last active March 15, 2022 08:52
let's findout who tells the truth and who lies
import Data.Maybe
import Data.List
import Control.Monad.State
import Control.Monad
type Var = String
type Value = String
type Variables = [(Var, Value)]
@ParsaAlizadeh
ParsaAlizadeh / fiml.desktop
Last active September 20, 2022 10:39
Remember which episode you had watched
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=inode/directory;
Actions=fimlAction;
Icon=videoclip-amarok
[Desktop Action fimlAction]
Name=Fiml
Icon=videoclip-amarok
@ParsaAlizadeh
ParsaAlizadeh / 3-coloring.c
Created January 14, 2024 18:46
3-coloring in non-deterministic polynomial time
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
enum {
SOLVED = 0,