- Some utilities:
sudo apt-get install vim tmux git
- Copy/paste from the command line:
sudo apt-get install xclip
#!/usr/bin/php | |
<?php | |
/** | |
* @url http://vredniy.ru | |
* @author Dmitry Zudochkin <[email protected]> | |
**/ | |
$obj = json_decode(file_get_contents('http://fucking-great-advice.ru/api/random')); |
# coding: utf-8 | |
require 'pp' | |
require 'rubygems' | |
require 'hpricot' | |
require 'iconv' | |
require 'net/http' | |
xml = File.read('9001274.xml') | |
# encoding: utf-8 | |
require 'mongo' | |
require 'mongo_mapper' | |
MongoMapper.database = 'words' | |
class Word | |
include MongoMapper::Document |
#! /bin/bash | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the unicorn web server | |
# Description: starts unicorn |
# as we’re going to use Unicorn as the application server | |
# we’re not going to use common sockets | |
# but Unix sockets for faster communication | |
upstream shop { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a | |
# single worker for timing out). | |
# for UNIX domain socket setups: | |
server unix:/tmp/shop.socket fail_timeout=0; |
require 'cgi' | |
namespace :b000 do | |
desc 'b000.ru images parser' | |
task :parser => :environment do | |
max_image_id = ENV['MAX_IMAGE_ID'] || 2344 | |
# чтобы по стопицот раз не пытаться сохранить одни и те же фотографии | |
min_image_id = ENV['MIN_IMAGE_ID'] || Image.scoped.select('max(external_id) AS m')[0].m |
call pathogen#infect() | |
set nocompatible | |
syntax on | |
set nu | |
set ruler | |
" настраиваем табуляцию | |
set shiftwidth=2 | |
set tabstop=2 |
require 'rubygems' | |
require 'erb' | |
require 'sinatra' | |
require 'dropbox' | |
configure do | |
enable :sessions | |
end | |
def authed? |
class CodeFormatter | |
def initialize(text) | |
@text = text | |
end | |
def to_html | |
text = @text.clone | |
codes = [] | |
text.gsub!(/^``` ?(.*?)\r?\n(.+?)\r?\n```\r?$/m) do |match| | |
code = { :id => "CODE#{codes.size}ENDCODE", :name => ($1.empty? ? nil : $1), :content => $2 } |