Skip to content

Instantly share code, notes, and snippets.

View Alir3z4's full-sized avatar
💭
Rock'nRolla

Alireza Savand Alir3z4

💭
Rock'nRolla
View GitHub Profile
for f in *.*; do echo "video file $f is under fucking processing"; ffmpeg -i $f $f.mkv"; done
*filter
# Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT -i lo -d 127.0.0.0/8 -j REJECT
# Accept all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow all outbound traffic - you can modify this to only allow certain traffic
sudo ip link set wlan0 down
sudo iwconfig wlan0 channel auto
sudo ip link set wlan0 up
sudo rm /var/run/wpa_supplicant/wlan0
sudo rm -rf /run/dhcpcd-wlan0.pid
sudo wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
#sleep 20
sudo dhcpcd wlan0
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
print 'Upgrading %s' % dist.project_name
call("pip2 install --upgrade " + dist.project_name, shell=True)
# Note
# mounting vmail
mount.s3ql --allow-other s3://archi-vmail /home/vmail/
# Chown to vmail:vmail
chown -R vmail:vmail /home/vmail/
# bring the ubuntu up ;)
passwd
adduser alireza
@Alir3z4
Alir3z4 / backup-archi,sh
Created November 7, 2012 12:36
dummy bk file
#!/bin/bash
# Author Alireza Savand
# CopyRight 2012 Alireza Savand
# Back up
echo "==========================================="
echo "Start to get /home/vmail dir backup"
echo "==========================================="
echo ""
echo "Compressing format gzip2"
# server {
# listen 80;
# server_name exampl.io www.exampl.io;
# access_log /srv/http/exampl.io/orgia/logs/access.log;
# error_log /srv/http/exampl.io/orgia/logs/error.log;
#
# #ssl on;
# #ssl_session_timeout 5m;
# #ssl_certificate /etc/ssl/certs/www.exampl.io.crt;
# #ssl_certificate_key /etc/ssl/private/www.exampl.io.key;
@Alir3z4
Alir3z4 / forms.py
Created November 30, 2012 00:03
Override the init to pass the current user to the model form.
class Formio(ModelForm):
def __init__(self, user=None, *args, **kwrags):
"""
Override the init to pass the current user
to the model form.
Then the current user will be passed to the form at
initializing time in views or any other situation where
``request`` is available.
"""
def utf8ify(value):
if not value: return
# remove some characters altogether
value = re.sub(r'[?.,;/:"\'\|!@#~`+=$%^&\\*()\[\]{}<>]','',value, re.UNICODE)
return value
def utf8ify_slugify(value):
value = utf8ify(value)
value = value.replace(" ", "-")
@Alir3z4
Alir3z4 / gist:5498409
Created May 1, 2013 21:10
direct_to_template to TemplateView django1.3 to newer ;)
find: direct_to_template, \{'template': ('[a-z/.\w-]+')}
replace: TemplateView.as_view(template_name=$1)