Skip to content

Instantly share code, notes, and snippets.

@Coolagin
Coolagin / django_tutorial.md
Last active February 5, 2020 08:23 — forked from mikpskov/django_tutorial.md
Конспект учебника по Django

Источник

Быстрое руководство по установке

Последнюю версию Python можно найти на http://www.python.org/download

Установка официальной версии с помощью pip

Создание виртуальной среды

Создания нового окружения

python -m venv venvset1

Запустим виртуальное окружение virtualenv, выполнив команду в командной строке Windows:

venvset1\Scripts\activate.bat
@Coolagin
Coolagin / gist:3654808
Created September 6, 2012 10:59
batcharge.py
# !/usr/bin/env python
# coding=UTF-8
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0]
o_cur = [l for l in output.splitlines() if 'CurrentCapacity' in l][0]
@Coolagin
Coolagin / ruby cheatsheet.md
Created June 25, 2012 18:33
ruby cheat sheet

#####Strings

""               #expansion
String.new       #constructor
''               #no expansion
%{}              #keeps formatting
%q{}             #keeps formatting no expansion
%w{a b c}        #returns an array of strings no expansion
string = <<EOF   #here document
@Coolagin
Coolagin / gist:2965136
Created June 21, 2012 11:03
test gist

This is the first level of quoting.

This is nested blockquote.

Back to the first level.

@Coolagin
Coolagin / gist:2965060
Created June 21, 2012 10:39
markdown short sheet