Skip to content

Instantly share code, notes, and snippets.

View ilius's full-sized avatar

Saeed Rasooli ilius

  • Iran
  • 06:48 (UTC +03:30)
View GitHub Profile
@ilius
ilius / main.go
Last active February 15, 2024 15:20
Go generators
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
import "io"
type Gen interface {
Next(args any...) (any, error) // EOF
End() bool
@ilius
ilius / appledict-bin-to-slob.py
Created November 10, 2023 07:59
appledict-bin-to-slob.py
#!/usr/bin/env python
import sys
from os.path import extsep, join, splitext
from pyglossary import slob
from pyglossary.core import cacheDir
from pyglossary.entry import Entry
from pyglossary.glossary_v2 import Glossary
from pyglossary.plugins.aard2_slob import Writer as SlobWriter
@ilius
ilius / docker-functions.sh
Last active March 7, 2024 06:11
Docker Bash functions
function docker-running-by-name() {
# docker ps --filter name=$1 --quiet # does not always work!
docker ps | grep "$@" | sed 's/ .*//' | head -n1
}
function docker-shell-to-name() {
ID=$(docker-running-by-name $1)
if [ -z $ID ] ; then
echo "No running container by image name $1"
return
#!/usr/bin/env python
import json
import sys
import biplist
plistPath = sys.argv[1]
try:
@ilius
ilius / json-to-tabfile.py
Last active May 31, 2023 05:11
VahidN/EnglishToPersianDictionaries
#!/usr/bin/env python
add_prefix = True
add_reverse = True
import os
import sys
from os.path import join
from json import load
# Go's template funcs:
# https://github.com/golang/go/blob/master/src/text/template/funcs.go
header_template = """
<b><font color='#ccf'>{{.DictName}}</font></b>
<font color='#aaa'> [%{{.Score}}]</font>
{{if .ShowTerms }}
<div dir="ltr" style="font-size: large;font-weight:bold;">
{{ index .Terms 0 }}
</div>
@ilius
ilius / prefix.txt
Created April 16, 2023 17:23
English prefixes and suffixes
a
ab
abs
ac
acantho
acet
aceto
acro
actino
ad
@ilius
ilius / dict-links.txt
Last active March 7, 2024 06:13
Dict Links
#!/bin/bash
# Discover monitor name with: xrandr | grep " connected"
# and set MONITOR
MONITOR=""
STEP="0.05"
MIN="0.1"
CurrBrightLine=$( xrandr --verbose --current | grep ^"$MONITOR" -A5 | tail -n1 )