Skip to content

Instantly share code, notes, and snippets.

View alirezaomidi's full-sized avatar

Alireza Omidi alirezaomidi

View GitHub Profile
@alirezaomidi
alirezaomidi / openconnect.sh
Last active November 28, 2023 12:04
Script to connect and disconnect to/from openconnect without pain
#!/bin/bash
# This script connects the computer to a vpn server using openconnect without pain
prog_name=$(basename $0)
# CHANGE YOUR_VPN_SERVER_DOMAIN to the VPN server you know like example.com
domain=YOUR_VPN_SERVER_DOMAIN
function help {
@alirezaomidi
alirezaomidi / acm-icpc-tehran-ranking.py
Created November 26, 2016 14:59
ACM ICPC Tehran Site University Ranking Extractor
from bs4 import BeautifulSoup
import requests
import re
import ast
import sys
URL = 'http://icpc.sharif.edu/acmicpc%s/scoreboard/' % sys.argv[1][-2:]
r = requests.get(URL)
soup = BeautifulSoup(r.text, 'html5lib')
@alirezaomidi
alirezaomidi / p2p-vs-cs.py
Created November 12, 2016 19:21
Minimum Distribution Time for Client-Server vs Peer-to-Peer
import matplotlib.pyplot as plt
# in Kbps
F = 10 * 10**6
us = 20 * 1000
dmin = 1000
def client_server(n):
return max(n*F/us, F/dmin)
@alirezaomidi
alirezaomidi / ctf.infosecinstitute.com.md
Last active August 29, 2015 14:26 — forked from professormahi/ctf.infosecinstitute.com.md
ctf.infosecinstitute.com CTF Challenge reviews
@alirezaomidi
alirezaomidi / sort.sh
Last active August 29, 2015 14:20
Scanner output sorter
#!/bin/bash
# Sorts the images which are scanned by a scanner in the following way: (last file index is 20 for e.g.)
# pages 1,3,5,... are named scan0000.jpg, scan0001.jpg, scan0002.jpg,...
# then pages 2,4,6,... are named scan0020.jpg, scan0019.jpg, scan0018.jpg, ...
# The script sorts them in range 000 to 020
mkdir -p final
end=`ls scan* -1 | wc -l`
flag=0
@alirezaomidi
alirezaomidi / recursive.c
Last active August 29, 2015 14:18
Prints $digits-permutation of 1 to $digits recursively
#include <stdio.h>
int digits, level;
int number[20];
int used[10];
void print() {
for (int i = 0; i < digits; i++)
printf("%d", number[i]);
printf("\n");
@alirezaomidi
alirezaomidi / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console