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 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); |
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 fix debian locale
$ sudo locale-gen "en_US.UTF-8" | |
$ dpkg-reconfigure locales |
View gist:a1829c1ac15ed55bd7ac
function isMobile() { | |
var a = (navigator.userAgent||navigator.vendor||window.opera); | |
if(/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu |
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' |
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 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 dbf2csv.py
#!/usr/bin/python | |
import csv | |
from dbfpy import dbf | |
import os | |
import sys | |
filename = sys.argv[1] | |
if filename.endswith('.dbf'): | |
print "Converting %s to csv" % filename |
View convert.sh
#!/bin/bash | |
# | |
# author: vmanyushin@gmail.com | |
# created: 31.08.2016 | |
# description: скрипт добавляет печать и подпись на документ. | |
# для работы скрипта в системе должен быть установлен imagemagick пакет | |
# | |
# описание параметров: | |
# $1 - имя исходного файла | |
# $2 - имя файла с печатью |
OlderNewer