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
#Конвертация всех psd в jpg. результат складывается в out2 | |
mogrify -format jpg -flatten -path out_dir dir/*.psd | |
# Рекурсивная конвертация из одной директории в другую | |
find dirname -type f -iname "*.jpg" -exec sh conv.sh \{\} new_dirname\; | |
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
from scipy.interpolate import griddata | |
import numpy as np | |
import Image as PILImage | |
def create_gradient(size, geometry): | |
""" | |
:param size: [x, y] | |
:param geometry: | |
{ | |
"right_top: { |
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
/* Copyright (C) Hola 2012, 2013 | |
* | |
* Добро пожаловать на олимпиаду программистов Hola! | |
* | |
* ПРАВИЛА: | |
* - Идеальное решение до 28-May-13 принесет вам 500 долларов США! | |
* - В случае хорошего (но не идеального) решения, мы вышлем замечания, чтобы | |
* помочь вам доработать код. | |
* - Идеальный ответ со второй попытки принесет вам 250 долларов США. | |
* |
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
HDD=$1 | |
BUFFER_SIZE=$(hdparm -i /dev/sda|grep -Po 'BuffSize=.*kB,'|sed -e 's/BuffSize=//' -e 's/kB,//') | |
echo "Start clean hdd $HDD" | |
CLEAN_CMD="dd if=/dev/random of=$HDD bs=${BUFFER_SIZE}kB" | |
for i in 1 2 | |
do | |
echo $CLEAN_CMD | |
$CLEAN_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
%\chapter{Введение} % нумерованный чаптер | |
\anonchapter{Введение} % ненумерованный | |
\begin{figure}[h] | |
\center{\includegraphics[width=1\linewidth]{Ch3_3_web_interface_schema}} | |
\caption{Схема главной страницы веб-интерфейса.} | |
\label{Ch3_3_web_interface_schema:image} | |
\end{figure} |
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
# -*- coding: utf-8 -*- | |
# http://360percents.com/posts/php-random-user-agent-generator/ | |
from datetime import timedelta, date | |
from random import randint, randrange, choice | |
PROCESSORS = { | |
'linux': ['i686', 'x86_64'], | |
'mac': ['Intel', 'PPC', 'U; Intel', 'U; PPC'] | |
} |
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
% sudo aptitude install xvfb wkhtmltopdf | |
% xvfb-run wkhtmltopdf test.html test.pdf | |
# http://stackoverflow.com/questions/13215120/how-do-i-make-python-qt-and-webkit-work-on-a-headless-server |
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 smtplib | |
import mimetypes | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.MIMEBase import MIMEBase | |
from email import Encoders | |
msg = MIMEMultipart('alternative') |
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
#port forwading | |
ssh -L 4040:localhost:4040 server -f | |
#port forwarding from server2 to client use server1 | |
ssh -L 3306:localhost:13306 server1 -f "ssh -L 13306:localhost:3306 server2 -f" |
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 binascii | |
>>> bin(int(binascii.hexlify('hello'), 16)) | |
'0b110100001100101011011000110110001101111' | |
>>> n = int('0b110100001100101011011000110110001101111', 2) | |
>>> binascii.unhexlify('%x' % n) | |
'hello' |