This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('Crypt/RSA.php'); | |
$rsa = new Crypt_RSA(); | |
$rsa->loadKey('<RSAKeyValue> | |
<Modulus> | |
... | |
</Modulus> | |
<Exponent>AQAB</Exponent> | |
<P> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
jd - ordinal = 1721425 | |
jd = ordinal + 1721425 | |
ordinal = jd - 1721425 | |
>>> date=(2015, 12, 19) ; gregorian.to_jd(*date) - datetime(*date).toordinal() | |
1721425 | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## https://gist.github.com/ilius/71cfdeb004b568ecd40c | |
from heapq import heappush, heappop | |
def hsortStream(stream, maxHeapSize, key=None): | |
""" | |
stream: a generator or iterable | |
maxHeapSize: int, maximum size of heap | |
key: a key function, as in `list.sort` method, or `sorted` function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total_memory_percentage = 20.0 | |
total_memory_max_megabytes = 8000 | |
memory_params_percentage = { | |
'shared_buffers': 25.0, | |
'work_mem': 1.0, | |
'maintenance_work_mem': 12.0, | |
'effective_cache_size': 62.0, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.py[oc] | |
*~ | |
#.Trash* | |
#.trash* | |
.hidden | |
*.patch* | |
*.bak | |
*.save | |
.hg | |
.bzr* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
####################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# recode a file from arabic windows(windows-1256) to utf8 | |
import sys, os | |
def winArabicToUtf8(s, ar2fa=True): | |
u = s.decode('windows-1256') | |
if ar2fa: | |
for item in [ | |
(u'ي',u'ی'), | |
(u'ك',u'ک'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Colorize string | |
class String | |
def colorize(color_code) | |
"\e[#{color_code}m#{self}\e[0m" | |
end | |
end | |
class Colors |