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 / gist:1440e4bf224a13707d7484bdeb7972d2
Created November 1, 2021 15:58
Remove all draft releases on GitHub
brew install hub
git clone git@github.com:username/reponame
cd reponame
hub release -f "%T (%S) %n" --include-drafts | grep " (draft)" | awk '{print $1}' | xargs -t -n1 hub release delete
#!/bin/bash
## Start and end months
MONTHS='1 2 3 4'
YEAR='2021'
### Downloading logs
echo "Making logs directory..."
mkdir -p logs && echo "...Success"
@DmitriyLyalyuev
DmitriyLyalyuev / htoprc
Created April 15, 2021 11:17
My htoprc
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=0
hide_userland_threads=0
shadow_other_users=0
show_thread_names=0
gdb
(gdb) file /opt/ruby-2.2.3/bin/ruby
(gdb) attach [pid]
# output of the C backtrace goes to the gdb console
(gdb) eval "backtrace"
# output of the Ruby application backtrace below goes to ruby stdout (rails logger?)
(gdb) call rb_backtrace()
(gdb) continue
@DmitriyLyalyuev
DmitriyLyalyuev / gist:645f06808eed24f9b081470ef9282156
Last active March 1, 2021 10:43
Install Nginx + Enterprise Passenger
# Setup Enterprise Passenger
# https://www.phusionpassenger.com/library/install/standalone/install/enterprise/rubygems_rvm/#step-1:-download-and-install-your-license-key
unset HISTFILE
export TOKEN=545d1d5b9e8c426b1.......................514dc2cb8a9b77309c054a38c9
gem source --add https://download:${TOKEN}@www.phusionpassenger.com/enterprise_gems/
gem install passenger-enterprise-server --no-rdoc --no-ri
# Compiling agent
export PASSENGER_ROOT=`passenger-config --root`
@DmitriyLyalyuev
DmitriyLyalyuev / setup_memcached_bitnami_wp.sh
Created November 17, 2019 12:32
Add memcached support to Bitnami WP stack
#!/bin/bash
export LIBMEMCACHED_VERSION='1.0.18'
export PHPMEMCACHED_VERSION='2.2.0'
# Install dependencies
sudo apt update
sudo apt install -y memcached
sudo apt install -y build-essential libtool autoconf unzip wget git pkg-config
@DmitriyLyalyuev
DmitriyLyalyuev / gist:91a8ff041691a8f5688b2ad50a8f0ea1
Created November 17, 2019 12:29
Install ruby via rbenv with jemalloc
sudo apt install libjemalloc-dev
sudo su - deployer
cd /home/deployer/.rbenv/plugins/ruby-build && git pull && cd -
CONFIGURE_OPTS="--with-jemalloc" rbenv install 2.6.5
@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