Skip to content

Instantly share code, notes, and snippets.

View vmanyushin's full-sized avatar

Viktor Manyushin vmanyushin

View GitHub Profile
@vmanyushin
vmanyushin / gist:9dd40d70ff4c90c8324a
Last active August 9, 2018 14:59
Install php 5.6 on Debian7
apt-get install software-properties-common python-software-properties
add-apt-repository 'deb http://packages.dotdeb.org wheezy-php56 all'
add-apt-repository 'deb-src http://packages.dotdeb.org wheezy-php56 all'
~~~~~~~~~~~~ jessy
add-apt-repository 'deb http://packages.dotdeb.org jessie all'
add-apt-repository 'deb-src http://packages.dotdeb.org jessie all'
~~~~~~~~~~~~
wget http://www.dotdeb.org/dotdeb.gpg
$ sudo locale-gen "en_US.UTF-8"
$ dpkg-reconfigure locales
@vmanyushin
vmanyushin / gist:e7c2394bca9888ab8abe
Created March 25, 2015 15:39
youtube responsive
.video-responsive {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow:hidden;
}
.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
position: absolute;
#!/usr/bin/php
<?php
$url = "http://habrahabr.ru/post/242657/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
@vmanyushin
vmanyushin / gist:5c04002d0309e0554af0
Last active August 29, 2015 14:01
Склонятор на ruby
#!/usr/bin/env ruby
require 'uri'
require 'open-uri'
require 'nokogiri'
uri = URI.parse('http://export.yandex.ru/inflect.xml')
params = { :name => "#{ARGV[0]}" }
uri.query = URI.encode_www_form( params )
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
#!/usr/bin/python
def hrun(start, width, padding=0):
return [None] * padding + range(start, start+width) + [None] * padding
def vrun(start, width, height, padding=0):
return [hrun(s, width, padding)
for s in range(start, start+width*height, width)]
layout = [
port = 10051
s = Zabbix::Sender.new 'zabbix-server', port
pp s.send('host', 'key', 'value')
# => {"response"=>"success",
# "info"=>"Processed 1 Failed 0 Total 1 Seconds spent 0.000042"}
pp s.to('host') {
send 'key', 'value'