Skip to content

Instantly share code, notes, and snippets.

View itsamirhn's full-sized avatar
🦉
Focusing

Amir Hosseini itsamirhn

🦉
Focusing
  • Divar
  • Tehran - IRAN
View GitHub Profile
@itsamirhn
itsamirhn / forti
Last active April 8, 2024 08:12
OpenFortiVPN easy usage with OTP in Terminal
#!/bin/zsh
### Fill these paramters in your enviroment
# export OPENFORTIVPN_GATEWAY = '...' (host:port)
# export OPENFORTIVPN_OTP = '...' (4-digit)
# export OPENFORTIVPN_OTP_COMMAND = '...' (runtime otp)
# export OPENFORTIVPN_CONFIG = '...' (config file path)
_forti() {
args=()
@itsamirhn
itsamirhn / MITCrawler.py
Last active July 23, 2022 06:57
A simple & messy crawler for downloading resources of MIT-LinearAlgebra course in structured folders
import shutil
from pathlib import Path
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm
HOST = 'https://ocw.mit.edu'
future_list = []
@itsamirhn
itsamirhn / SierpinskiFrame.java
Last active June 17, 2022 09:25
Draw Sierpinski iTriangle in GUI
import javax.swing.*;
import java.awt.*;
public class SierpinskiFrame extends JFrame {
public static void main(String[] args) {
SierpinskiFrame frame = new SierpinskiFrame();
frame.setSize(600, 600);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
@itsamirhn
itsamirhn / Sierpinski.java
Created June 17, 2022 08:33
Draw Sierpinski Triangle using * in output.
import java.util.Scanner;
public class Sierpinski {
public static String[] T(int n) {
if (n == 0) {
String[] ans = new String[1];
ans[0] = "*";
return ans;
}
String[] prev = T(n - 1);