Skip to content

Instantly share code, notes, and snippets.

@imirzadeh
imirzadeh / rss.go
Created February 14, 2023 00:49
RSS Detection GO
func DetectRSSLink(ctx context.Context, URL string, body string) []string {
doc, err := html.Parse(strings.NewReader(body))
var candidates []string
if err != nil {
return candidates
}
links := FindAll(doc, "link")
for _, link := range links {
if GetAttr(link, "rel") == "alternate" {
attrHref := GetAttr(link, "href")
inp = jnp.array([[[l[x], G[i]][0] for i in range(len(G))] for x in range(len(l))])
@imirzadeh
imirzadeh / todoist_import.py
Created July 17, 2020 00:24
Python Script to Import tasks from Asana to Todoist
import pandas as pd
from todoist.api import TodoistAPI
ASANA_TASKS_CSV_PATH = './asana.csv'
# creates this project and import all tasks from asana csv file to this project in todoist
TODOIST_PROJECT_NAME = 'Asana Imports'
TODOIST_TOKEN = 'REPLACE_YOUR_TODOIST_TOKEN'
# read asana tasks
# import required packages
import torch
import torch.nn.functional as F
from torch_geometric.datasets import Planetoid
from torch_geometric.data import DataLoader
from torch_geometric.nn import GCNConv
# load Cora dataset
dataset = Planetoid(root='/tmp/Cora', name='Cora')
loader = DataLoader(dataset, batch_size=32, shuffle=True)
@imirzadeh
imirzadeh / clean.py
Created March 22, 2018 13:51
Persian Text Cleaner
persian_alphabet = '۱۲۳۴۵۶۷۸۹۰ٸآابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی'
def create_persian_sub_mapping():
kaf_alt = 'كڬڬڭګڪ'
gaf_alt = 'ڲڳ'
ye_alt = 'ۍېيێئ'
vav_alt = 'ۅۋۈۉٶۇۆۊؤٶ'
hamze_alt = 'ٳٱأٲإ'
he_alt = 'ۃۀہةە'
from mininet.topo import Topo
class MyTopo( Topo ):
"Simple topology example."
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
@imirzadeh
imirzadeh / issue
Created September 2, 2014 08:18
issues
Environment:
Request Method: GET
Request URL: http://localhost:8000/admin
Django Version: 1.6.5
Python Version: 2.7.3
Installed Applications:
('django.contrib.admin',
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Index Page</title>
<!-- external scripts -->
<!-- jQuery & Bootstrap -->
<script type="text/javascript" src="{% static "js/jquery.js" %}"/></script>