Skip to content

Instantly share code, notes, and snippets.

View savonarola's full-sized avatar
🏠
Working from home

Ilia Averianov savonarola

🏠
Working from home
View GitHub Profile
[{:name "Улица Подбельского", :line 1, :coords {:lat 55.8148, :lng 37.7342}} {:name "Черкизовская", :line 1, :coords {:lat 55.8038, :lng 37.7448}} {:name "Преображенская площадь", :line 1, :coords {:lat 55.7963, :lng 37.7151}} {:name "Сокольники", :line 1, :coords {:lat 55.7888, :lng 37.6802}} {:name "Красносельская", :line 1, :coords {:lat 55.7801, :lng 37.6673}} {:name "Комсомольская", :line 1, :coords {:lat 55.7753, :lng 37.6562}} {:name "Красные ворота", :line 1, :coords {:lat 55.769, :lng 37.6487}} {:name "Чистые пруды", :line 1, :coords {:lat 55.7657, :lng 37.6388}} {:name "Лубянка", :line 1, :coords {:lat 55.7597, :lng 37.6272}} {:name "Охотный ряд", :line 1, :coords {:lat 55.7577, :lng 37.6166}} {:name "Библиотека имени Ленина", :line 1, :coords {:lat 55.7512, :lng 37.61}} {:name "Кропоткинская", :line 1, :coords {:lat 55.7453, :lng 37.6037}} {:name "Парк культуры", :line 1, :coords {:lat 55.7356, :lng 37.5943}} {:name "Фрунзенская", :line 1, :coords {:lat 55.7267, :lng 37.5786}} {:name "Спортивная",
>curl -s 'http://prntscr.com/2aklf9' | nokogiri -e'puts $_.css("meta").find{|m| m["property"] == "og:image"}["content"]' | xargs wget
--2014-02-18 23:19:53-- http://i.imgur.com/06Y5QpF.png
Resolving i.imgur.com... 103.31.6.32, 103.31.6.184, 103.31.6.34, ...
Connecting to i.imgur.com|103.31.6.32|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11173 (11K) [image/png]
Saving to: ‘06Y5QpF.png’
100%[==========================================================================================================>] 11,173 --.-K/s in 0s
# -*- coding: utf-8 -*-
require 'socket'
require 'rubygems'
require 'json'
require 'pp'
module Zabbix
class Sender
def self.send(host, serv='localhost', port=10051, conf='/etc/zabbix/zabbix_agentd.conf', &blk)
s = new serv, port, conf
module Main where
import Control.Monad
import qualified Data.ByteString.Lazy.Char8 as B
import System.Directory
import System.Environment
import System.FilePath
import System.IO
main :: IO ()
{
"Шаболовская":[
{
"lat":"55.7188151",
"lon":"37.6079539"
}
],
"Улица Подбельского":[
{
"lat":"55.8141448",
test=# \d t1
Table "public.t1"
Column | Type | Modifiers
--------------+-----------------------------+-------------------------------------------------
id | integer | not null default nextval('t1_id_seq'::regclass)
type | character varying | default ''::character varying
published_at | timestamp without time zone | default timezone('UTC'::text, now())
Indexes:
"t1_published_at_idx" btree (published_at)
#!/usr/bin/perl -w
use strict;
use Time::HiRes qw(time);
my $word_count = 800;
my $word_length = 8;
my $words = [map { random_word($word_length) } 1..$word_count];
my $text = random_word(1000000);
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
@savonarola
savonarola / gist:4620562
Created January 24, 2013 11:50
Generate all finite sequences of letters (a-z)
def each_str
l = 0
while true
s = 'a' * (l + 1)
while true
yield s
if s[l] == 'z'
i = l
i -= 1 while s[i] == 'z' && i >= 0
if i >= 0
@savonarola
savonarola / benchmark.txt
Last active December 11, 2015 14:08
Отгрузка списка ~200 небольших записей такого вида: rails g scaffold Post title body:text. Работа с бд в обоих случаях заняла пренебрежимо мало
1.9.3-p194-perf, rails, 10 unicorns
>siege -r 200 -c 10 -d 0 'http://localhost:9080/posts'
** SIEGE 2.72
** Preparing 10 concurrent users for battle.
The server is now under siege.. done.
Transactions: 2000 hits
Availability: 100.00 %
Elapsed time: 117.59 secs