Skip to content

Instantly share code, notes, and snippets.

View ilius's full-sized avatar

Saeed Rasooli ilius

View GitHub Profile
@ilius
ilius / build-goldendict-qt4.sh
Created December 15, 2020 17:18
Build GoldenDict with Qt on Debian
#!/bin/bash
set -e
# Debian:
echo 'deb http://ppa.launchpad.net/rock-core/qt4/ubuntu focal main
deb-src http://ppa.launchpad.net/rock-core/qt4/ubuntu focal main' > /etc/apt/sources.list.d/qt4.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78CB407D3E3D8F94
sudo apt-get update
# -*- coding: utf-8 -*-
# http://www.octopus-studio.com/download.en.htm
import os
from os.path import isdir
from pyglossary.compression import compressionOpen as c_open
from pyglossary.compression import stdCompressions
from pyglossary.core import log
from pyglossary.option import (
@ilius
ilius / article-style.css
Last active May 22, 2025 17:05 — forked from bangedorrunt/article-style.css
GoldenDict Dark Theme
body
{
margin-top: 1px;
margin-right: 3px;
margin-left: 2px;
margin-bottom: 3px;
background: #201F1F;
color: white;
font-family: Bookerly, Segoe UI, Palatino Linotype, Arial Unicode MS;
}
@ilius
ilius / job-ad-guide.md
Last active March 7, 2024 06:15 — forked from hristian-carabulea/Guide.md
A Guide to Software Developer Job Advertisements
Job Description Actual meaning
A fast-paced environment Your job will be constant firefighting
A market leader Recently started making a profit
Able to work with minimal spervision You'll be the one we blame when something goes wrong
An Agile team We have daily stand-ups
Dynamic environment Our leadership keeps changing priorities
Must be a team player Must not question authority
Ninja You do all the work alone
Passionate You wil
@ilius
ilius / jalali-plpgsql.sql
Last active June 11, 2024 05:52
Jalali Date Conversion in PL/pgSQL
create or replace function epoch_to_jd(float) RETURNS int as $$
BEGIN
return ($1 / (24*3600) + 2440588)::int;
END;
$$ LANGUAGE plpgsql;
create or replace function timestamp_to_jd(timestamp with time zone) RETURNS int as $$
BEGIN
return epoch_to_jd(extract (epoch from $1));
#!/usr/bin/env perl
=dependencies:
sudo cpan get Mojolicious
sudo cpan get MongoDB
sudo cpan get Set::Light
sudo cpan get Log::Log4perl
sudo cpan get DateTime::Format::Strptime
sudo cpan get File::HomeDir
sudo cpan get Digest::SHA1
import random
from math import log
'''
findMaxDisplace = lambda array: \
max(
origIndex - sortedIndex \
for sortedIndex, (origIndex, value) in \
enumerate(
sorted(
#!/usr/bin/python
import os, sys
def getDateTime(imPath):## output sample: '2005:01:01_12:02:16'
if not os.path.exists(imPath):
print 'Error: Image file \''+imPath+'\' dose not exit!'
sys.exit(1)
if os.path.isdir(imPath):
print 'Error: \''+imPath+'\' is a directory!'
sys.exit(1)
#!/bin/bash
git show-ref --abbrev --heads | sed 's/refs\/heads\///g' | sort | uniq -w 7 -D
import random
def weighted_choice(choices):
if isinstance(choices, dict):
choices = choices.items()
total = sum(w for c, w in choices)
r = random.uniform(0, total)
upto = 0
for c, w in choices:
if upto + w >= r: