Skip to content

Instantly share code, notes, and snippets.

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

Dade Murphy DmitriyLyalyuev

💭
Trying to exit vim
View GitHub Profile
@DmitriyLyalyuev
DmitriyLyalyuev / gist:4e61645c1b36771645f88daa8ba50b2e
Created August 15, 2019 11:20
s3 cross account replication with aws cli
aws s3 sync s3://SOURCE-BUCKET-NAME s3://DESTINATION-BUCKET-NAME --source-region SOURCE-REGION-NAME --region DESTINATION-REGION-NAME
@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.
#
@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 / .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 / .bash_aliases
Created November 14, 2017 12:30
Alias for terraform
alias tf='terraform'
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 / 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;
@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
# -*- 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 / 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) {