Skip to content

Instantly share code, notes, and snippets.

View prokoptsev's full-sized avatar

Alexey Prokoptsev prokoptsev

View GitHub Profile
@chergert
chergert / chergsedit.py
Created March 19, 2011 01:33
try to get spacing/formatting right for my C style with gtksourceview
#!/usr/bin/env python
"""
A simple editor built for live editing in GLib'ish manner.
"""
from gi.repository import GLib
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import GtkSource
@shvechikov
shvechikov / upprint.py
Created February 27, 2012 09:11
UnicodePrettyPrinter
# -*- coding: utf-8 -*-
import sys
from pprint import PrettyPrinter
class UnicodePrettyPrinter(PrettyPrinter):
"""Unicode-friendly PrettyPrinter
Prints:
- u'привет' instead of u'\u043f\u0440\u0438\u0432\u0435\u0442'
@davatron5000
davatron5000 / gist:2254924
Created March 30, 2012 20:57
Static Site Generators

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@kxtells
kxtells / cSpinner.py
Created July 20, 2012 20:35
Rotating Stick Class for Python
import sys
import threading
import time
class cSpinner(threading.Thread):
"""
Print things to one line dynamically
"""
chars = ["\\","|","/","-"]
index = 0
@mehcode
mehcode / install-pygtk.sh
Created August 7, 2013 09:49
Install pygtk inside of a virtualenv
# Ensure we're in a virtualenv.
if [ "$VIRTUAL_ENV" == "" ]
then
echo "ERROR: not in a virtual environment."
exit -1
fi
# Setup variables.
CACHE="/tmp/install-pygtk-$$"
@matrixise
matrixise / validator.py
Created September 2, 2013 21:09
Explain the validators of SQLAlchemy.
#!/usr/bin/env python
import datetime
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.schema import CheckConstraint
from sqlalchemy.orm import validates
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.exc import IntegrityError
@plentz
plentz / nginx.conf
Last active July 22, 2024 11:19
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@mad4j
mad4j / networkcopy.sh
Last active February 26, 2016 07:18
use tar command through network over ssh session
#from local to remote with local compression
#(less bandwidth, more local processing)
tar zcvf - /home/app | ssh root@192.168.1.1 "cat > /tmp/backup.tar.gz"
#from local to remote with remote compression
#(more bandwidth, less local processing)
tar cvf - /home/app | ssh root@192.168.1.1 "gzip > /tmp/backup.tar.gz"
@nolanlawson
nolanlawson / promises_answer_sheet.md
Last active July 26, 2022 08:02
Promises puzzle cheat sheet
# habraproxy.py — это простейший http-прокси-сервер, запускаемый локально (порт на ваше
# усмотрение), который показывает содержимое страниц Хабра. С одним исключением: после
# каждого слова из шести букв должен стоять значок «™». Примерно так:
#
# http://habrahabr.ru/company/yandex/blog/258673/
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Сейчас на фоне уязвимости Logjam все в индустрии в очередной раз обсуждают проблемы и
# особенности TLS. Я хочу воспользоваться этой возможностью, чтобы поговорить об одной из
# них, а именно — о настройке ciphersiutes.
#