Skip to content

Instantly share code, notes, and snippets.

View greggyNapalm's full-sized avatar

Gregory Komissarov greggyNapalm

  • Saint-Petersburg
View GitHub Profile
@greggyNapalm
greggyNapalm / gist:1862955
Created February 19, 2012 10:15
rmv; linux
rvm get latest
rvm reload
rvm rvmrc trust
rvm install ruby-1.9.3-p0
rvm rubygems latest
@greggyNapalm
greggyNapalm / vim_install_from_source
Created March 3, 2012 08:57
vim install from source
hg clone https://vim.googlecode.com/hg/ vim
cd vim/src
./configure --prefix=/opt/vim --enable-pythoninterp --enable-cscope --with-features=huge --with-tlib=ncurses
make
@greggyNapalm
greggyNapalm / python_workbench_mac.rst
Last active November 7, 2015 15:09
python dev env; mac os
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@greggyNapalm
greggyNapalm / gist:2282242
Last active May 9, 2022 07:26
TCP/IP stack linux
# increase system IP port limits
net.ipv4.ip_local_port_range=1024 65535
# Incoming packets queue length
net.core.netdev_max_backlog=10000
# TCP socket max connections num
net.core.somaxconn=262144
# Enable syncookies
@greggyNapalm
greggyNapalm / gist:2282306
Last active October 2, 2015 17:08
python dev env; linux
#----------------------
# Ubuntu 8.04 LTS/hardy
#----------------------
# to build python from source
# apt-get install zlib1g-dev
# to build extensions
apt-get install build-essential
apt-get install python-dev
@greggyNapalm
greggyNapalm / gist:2359365
Created April 11, 2012 13:42
Ubuntu 10 LTS; postinstall
# remove apparmor
sudo /etc/init.d/apparmor kill
sudo update-rc.d -f apparmor remove
# add aptitude and upgrade packets
sudo apt-get install aptitude
sudo aptitude update; aptitude upgrade
sudo aptitude install openssh-server
@greggyNapalm
greggyNapalm / gist:2413028
Created April 18, 2012 11:37
linux errno codes
# @see /usr/include/asm-generic/errno-base.h
#ifndef _ASM_GENERIC_ERRNO_BASE_H
#define _ASM_GENERIC_ERRNO_BASE_H
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
@greggyNapalm
greggyNapalm / gist:2473116
Created April 23, 2012 19:03
Ubuntu 12 LTS; postinstall
# remove unnecessary
#-------------------
sudo /etc/init.d/apparmor stop
sudo update-rc.d -f apparmor remove
sudo mv /etc/motd /etc/motd_orig
# upgrade packets
sudo aptitude update && aptitude upgrade
@kennethreitz
kennethreitz / flaskapp.py
Created June 9, 2012 15:38
My typical flask app base
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_heroku import Heroku
from flask_sslify import SSLify
from raven.contrib.flask import Sentry
from flask.ext.celery import Celery