Skip to content

Instantly share code, notes, and snippets.

View Glyphack's full-sized avatar
🔨
Programming

Shaygan Hooshyari Glyphack

🔨
Programming
View GitHub Profile
@Glyphack
Glyphack / primer.md
Last active September 2, 2025 20:59
mypy primer tools

Run primer:

#!/usr/bin/env bash
set -euo pipefail

mkdir -p "$HOME/.config/ty"
cp ".github/mypy-primer-ty.toml" "$HOME/.config/ty/ty.toml"

PRIMER_SELECTOR="core|dd-trace-py|manticore|materialize|operatorprefect"

Lezen

Category URL
A2: Frequentie #1 (meest frequent) p1 Link
A2: Frequentie #1 (meest frequent)/2 Link
A2: Frequentie #1 (meest frequent)/4 Link
A2: Frequentie #1 (meest frequent)/5 Link
A2: Frequentie #2 p1 Link
A2: Frequentie #2/2 Link
@Glyphack
Glyphack / redirect.lua
Created December 29, 2023 11:47
Redirect URLs with Hammerspoon
-- Define the Lua table that maps names to URLs
local urlTable = {
john = "https://example.com/john",
alice = "https://example.com/alice",
bob = "https://example.com/bob",
}
-- Register a callback for the custom hammerspoon:// URLs
hs.urlevent.bind("example", function(eventName, params, senderPID)
local event = eventName -- The event name is the host in hammerspoon://host
@Glyphack
Glyphack / print_symbol_table.py
Created August 18, 2023 19:22
Script to print symbol table of a python code
import symtable
def print_symbol_table_info(symbol_table: symtable.SymbolTable, indent=0):
# Print the information of the current symbol table
print(" " * indent + f"Symbol Table: {symbol_table.get_name()}")
print(" " * (indent + 2) + f"Type: {symbol_table.get_type()}")
print(" " * (indent + 2) + f"Identifier: {symbol_table.get_id()}")
print(" " * (indent + 2) + f"First Line Number: {symbol_table.get_lineno()}")
# print(" " * (indent + 2) + f"Is Optimized: {symbol_table.is_optimized()}")
# print(" " * (indent + 2) + f"Is Nested: {symbol_table.is_nested()}")
@Glyphack
Glyphack / game-of-life.go
Created May 29, 2023 14:59
Game of life in go
package main
import "fmt"
type Cell struct {
x int
y int
state int
}
@Glyphack
Glyphack / channels_blocking.go
Created March 11, 2023 15:22
Golang: Wait group, channels, blocking operation
package main
import (
"fmt"
"sync"
)
func main() {
ch := make(chan int)
wg := sync.WaitGroup{}
@Glyphack
Glyphack / avro_schema_to_swagger.py
Last active September 1, 2022 10:39
Generate openapi swagger object definition form avro schema
"""
Convert Avro schema files to swagger object definitions.
"""
import argparse
import json
from dataclasses import dataclass
from typing import Dict, List
parser = argparse.ArgumentParser(
description="Convert avro schema file to swagger object definition"
@Glyphack
Glyphack / 2fa.py
Created August 8, 2020 18:11
a script to copy steam 2fa code into clipboard
from steampy import guard
import pyperclip
pyperclip.copy(guard.generate_one_time_code("shared secret"))
@Glyphack
Glyphack / test_schema.py
Created August 23, 2019 14:36
graphql test case
from django.contrib.auth import get_user_model
from utils.test_utils import APITestCase
from .graphql_requests import (
CREATE_LINK_MUTATION
)
class LinkTestCase(APITestCase):
def setUp(self):
@Glyphack
Glyphack / graphql_test_utils.py
Created August 23, 2019 14:18
functions to test graphql api with python
from django.contrib.auth.models import AnonymousUser
from django.test import RequestFactory
from snapshottest.django import TestCase
from graphene.test import Client
from hackernews.schema import schema
class APITestCase(TestCase):
def setUp(self):