Skip to content

Instantly share code, notes, and snippets.

AmirAli Akbari amiraliakbari

Block or report user

Report or block amiraliakbari

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
amiraliakbari / main.css
Created Apr 29, 2018
Slack Persian Fix
View main.css
@font-face {
font-family: 'IRANSans';
src : url(""), url('') format('woff'), url('') format('truetype'), url("") format('woff2');
.c-message {
font-family: 'IRANSans', 'B Nazanin';
.c-message__content {
amiraliakbari / proxy.pac
Last active Sep 16, 2017
Proxy Auto Configuration
View proxy.pac
* Proxy auto configuration file for accessing sites blocked in Iran due to
* sanctons or filtering. To use, a socks5 proxy must be running and accessible
* on localhost port 1080. Set url of this gist in "Automatic proxy configuration URL"
* field in "Network Proxy Settings" in Firefox.
function FindProxyForURL(url, host) {
var blockedHosts = [
'', '', // Twitter
amiraliakbari / a.txt
Created Apr 28, 2017
Bash Useful Gists
View a.txt
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command <' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty.
* '!!:n' selects the nth argument of the last command, and '!$' the last arg
View get_plan_score
CREATE OR REPLACE FUNCTION get_plan_score(faculty_id integer, from_date date, until_date date)
fdate date ,
udate date ,
score int ) AS
DECLARE res integer;
DECLARE unit integer;
amiraliakbari /
Created Jan 6, 2016
ET = None
ET_has_iterparse = False
def ensure_elementtree_imported(verbosity, logfile):
global ET, ET_has_iterparse
if ET is not None:
if "IronPython" in sys.version:
import xml.etree.ElementTree as ET
#### fails later with
amiraliakbari / XKB IR Keyboard
Last active Oct 17, 2017
XKB Customized Persian Keyboard Layout
View XKB IR Keyboard
// Iranian keyboard layout
// Replace with "/usr/share/X11/xkb/symbols/ir"
// Customized Version
// Persian layout,
// based on
// Information Technology – Layout of Persian Letters and Symbols on Computer Keyboards
// ISIRI 9147 – 1st Edition
amiraliakbari /
Created Oct 3, 2015
Refactoring Exercise
def get_page_from_queue():
pages = Page.objects.filter(username=q_key)
if pages:
page = pages[0]
setattr(page, 'priority', q_value)
pq = PageQueue(username=q_key, priority=q_value)
amiraliakbari /
Created Apr 16, 2015
Fix special characters in filenames
#!/usr/bin/env python
def rr(dir):
for d in os.listdir(dir):
dd = d.replace('\xef\x80\xa2', '-')
if d != dd:
os.rename(os.path.join(dir, d), os.path.join(dir, dd))
child = os.path.join(dir, dd)
if os.path.isdir(child):
amiraliakbari /
Created Feb 6, 2015
Remove .pyc files in current directory recursively
import os
import subprocess
for dirpath, dirnames, filenames in os.walk(os.getcwd()):
for each_file in filenames:
if each_file.endswith('.pyc'):
if os.path.exists(os.path.join(dirpath, each_file)):
os.remove(os.path.join(dirpath, each_file))
#!/usr/bin/env python
import ConfigParser
import os
import time,sys
PATH = '/www/PNAME/src/backup/'
# On Debian, /etc/mysql/debian.cnf contains 'root' a like login and password.
config = ConfigParser.ConfigParser()"/etc/mysql/debian.cnf")
You can’t perform that action at this time.