Skip to content

Instantly share code, notes, and snippets.

View DmitriyLyalyuev's full-sized avatar
💭
Trying to exit vim

Silver Ghost DmitriyLyalyuev

💭
Trying to exit vim
View GitHub Profile
@DmitriyLyalyuev
DmitriyLyalyuev / readline.c.patch
Last active August 29, 2015 14:06
ruby 2.0.0-p353 patch
--- ext/readline/readline.c 2014-09-10 12:39:40.957422393 +0200
+++ ext/readline/readline.c 2014-09-10 12:20:21.000000000 +0200
@@ -1883,7 +1883,7 @@
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
#endif
#ifdef HAVE_RL_CATCH_SIGNALS
@DmitriyLyalyuev
DmitriyLyalyuev / server.conf
Created October 7, 2014 11:20
Nginx config WP Super Cache
server {
listen 80 default;
server_name example.com www.example.com;
server_name_in_redirect off;
default_type text/html;
set $cache_uri $request_uri;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
# -*- coding: utf-8 -*-
"""
This script will delete all of the tweets in the specified account.
You may need to hit the "more" button on the bottom of your twitter profile
page every now and then as the script runs, this is due to a bug in twitter.
You will need to get a consumer key and consumer secret token to use this
script, you can do so by registering a twitter application at https://dev.twitter.com/apps
@requirements: Python 2.5+, Tweepy (http://pypi.python.org/pypi/tweepy/1.7.1)
@DmitriyLyalyuev
DmitriyLyalyuev / README.md
Created November 12, 2015 08:37 — forked from hwdsl2/.MOVED.md
IPsec L2TP VPN Auto Install Script for Ubuntu 14.04 & 12.04 and Debian 8
@DmitriyLyalyuev
DmitriyLyalyuev / w3tc-php7.patch
Created November 20, 2015 09:12
Patch W3 Total Cache plugin for PHP7 support
--- wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCache.php 2015-11-20 11:19:10.595861000 +0300
+++ wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCache.php 2015-11-20 11:18:09.859861000 +0300
@@ -509,7 +509,7 @@
* @param string $buffer
* @return string
*/
- function ob_callback(&$buffer) {
+ function ob_callback($buffer) {
global $wpdb;
def get_ratings():
result = {}
url = 'https://readrate.com/rus/users/%s/books' % (os.environ.get('USERID'))
html = lxml.html.fromstring(urllib2.urlopen(url).read())
books = html.xpath('//div[@class="book item"]')
for book in books:
title = book.xpath('div/div[2]/div/div/a')[0].text
rating = len(book.xpath('div[@class="wrapper clearfix"]/div[@class="cover"]/div[@class="picture"]/div[@class="content"]/div[@class="user-rating-stars"]/ul/li[contains(@class, "active")]'))
result.update({title: rating})
return result
@DmitriyLyalyuev
DmitriyLyalyuev / .bash_aliases
Created November 14, 2017 12:30
Alias for terraform
alias tf='terraform'
@DmitriyLyalyuev
DmitriyLyalyuev / .gitcommit
Last active August 1, 2018 06:59
Git commit template
[tag][#ISSUE] Subject
# |<---- Using a Maximum Of 50 Characters ---->|
Description
BREAKING CHANGES:
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# --- COMMIT END ---
# Tag can be
# feat (new feature)
@DmitriyLyalyuev
DmitriyLyalyuev / redis_migrate.py
Created October 16, 2018 10:07
Redis keys migrating tool
#!/usr/bin/env python
import argparse
import redis
def connect_redis(conn_dict):
conn = redis.StrictRedis(host=conn_dict['host'],
port=conn_dict['port'],
db=conn_dict['db'])
return conn
@DmitriyLyalyuev
DmitriyLyalyuev / default
Created February 6, 2019 20:07
Ubuntu default site config
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#