Skip to content

Instantly share code, notes, and snippets.

Avatar

Viktor Manyushin vmanyushin

View GitHub Profile
@vmanyushin
vmanyushin / gist:9dd40d70ff4c90c8324a
Last active Aug 9, 2018
Install php 5.6 on Debian7
View gist:9dd40d70ff4c90c8324a
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
View fix debian locale
$ sudo locale-gen "en_US.UTF-8"
$ dpkg-reconfigure locales
View gist:e7c2394bca9888ab8abe
.video-responsive {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow:hidden;
}
.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
position: absolute;
View gist:b385ce215e572d11e7db
#!/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 Aug 29, 2015
Склонятор на ruby
View gist:5c04002d0309e0554af0
#!/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 )
View cors-nginx.conf
#
# 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.
#
View show-all-256-colors.py
#!/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 = [
View sample.rb
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'