Skip to content

Instantly share code, notes, and snippets.

View ilius's full-sized avatar

Saeed Rasooli ilius

  • Iran
  • 06:41 (UTC +03:30)
View GitHub Profile
import random
from math import log
'''
findMaxDisplace = lambda array: \
max(
origIndex - sortedIndex \
for sortedIndex, (origIndex, value) in \
enumerate(
sorted(
proc PlayNumber { amount } {
# _200+.au _30+.au _4.au _1000+.au _1.au
#puts "\nDEBUGGING : PlayNumber: amount=$amount"
set result {}
#######################
if { $amount <= 20 } {
lappend result "_$amount.au"
return $result
}
#######################
<?php
function jmktime($h='',$m='',$s='',$jm='',$jd='',$jy=''){
$h=tr_num($h); $m=tr_num($m); $s=tr_num($s); $jm=tr_num($jm); $jd=tr_num($jd); $jy=tr_num($jy);
if($h=='' and $m=='' and $s=='' and $jm=='' and $jd=='' and $jy==''){
return mktime();
}
list($year,$month,$day)=jalali_to_gregorian($jy,$jm,$jd);
$epoch = mktime($h,$m,$s,$month,$day,$year);
$tz = new DateTimeZone('Asia/Tehran');
import os
import psutil
ps_by_pid = dict([(p.pid, p) for p in psutil.get_process_list()])
my_pid = os.getpid()
#my_proc = ps_by_pid[my_pid]
my_proc = psutil.Process(my_pid)
my_cmd = my_proc.cmdline() ## list, for example: ['python3', 'psutil-example.py']
print(my_pid, my_cmd)
@ilius
ilius / random-ja-word.sh
Last active January 8, 2021 06:07
Generate random Japanese-style words that are pronounceable
#!/bin/bash
# need to install https://github.com/ilius/repassgen
# u i a e o
G0='ういあえお'
# shi ki ni ka
G1='しきにか'
# no chi ku to ha ta
@ilius
ilius / pharmaplus.py
Created January 17, 2021 23:24
pharmaplus.py
# -*- coding: utf-8 -*-
from formats_common import *
import html
enable = True
format = 'Pharmaplus'
description = 'Pharmaplus (SQLite3)'
extensions = ()
readOptions = []
@ilius
ilius / pharmaplus-no-brand.py
Last active January 18, 2021 03:27
pharmaplus
# -*- coding: utf-8 -*-
from formats_common import *
import html
enable = True
format = 'Pharmaplus'
description = 'Pharmaplus (SQLite3)'
extensions = ()
readOptions = []
@ilius
ilius / Drug-guide.py
Created January 17, 2021 02:29
Drug-guide.py
# -*- coding: utf-8 -*-
from formats_common import *
import html
enable = True
format = 'Drug-guide'
description = 'Drug-guide (SQLite3)'
extensions = ()
readOptions = []
#!/bin/bash
TOTAL=0
OPTS="-type f -and -not -path '*/.git/*'"
# find . $OPTS -exec file --brief --mime-type \;
LOC=`find . $OPTS -name '*.go' -exec cat '{}' \; | grep -vxch '\s*'`
[[ $LOC -gt 0 ]] && echo -e "$LOC\tGo" && TOTAL=$[TOTAL+LOC]
@ilius
ilius / shallow-parser-test.py
Last active November 29, 2021 08:11
Hazm Persian NLP: shallow-parser-test.py
# coding: utf8
from __future__ import unicode_literals
import sys, os
from os.path import join
import json
homeDir = os.getenv('HOME')