Skip to content

Instantly share code, notes, and snippets.

View vkhazin's full-sized avatar

Vlad Khazin vkhazin

  • ICS Solutions Inc
  • Canada
View GitHub Profile
# Redis on RedHat 7.2
# To execute:
# curl -s 'https://gist.githubusercontent.com/vkhazin/f5c1b6e36e3a6c29aaf882041aaf78cb/raw/76de41b46cbf3749291ae87eef18cb71ce4c4d05/redhat-redis-setup.sh' | sh
sudo yum install wget -y
wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/e/
sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-*.rpm
sudo yum install redis -y
sudo mkdir /etc/redis
sudo semanage port -a -p tcp 16379 -t redis_port_t
sudo mv /etc/redis.conf /etc/redis.conf.bak
# /etc/redis.conf
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf
# Note on units: when memory size is needed, it is possible to specify
# it in the usual form of 1k 5GB 4M and so forth:
# Redis cluster
sudo yum install ruby -y
gem install redis
wget http://download.redis.io/redis-stable/src/redis-trib.rb
chmod +x ./redis-trib.rb
./redis-trib.rb create 172.31.11.148:6379 172.31.12.11:6379 172.31.10.4:6379
#!/bin/bash
# http://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html#sysman-install-ssm-agent
cd /tmp
sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
declare @CustomerID int
set @CustomerID = 342
--Original statement
select aut.[Token]
, aut.[UserName]
, aut.[LastAuthenticationTime]
, aut.[LoginSourceType]
, aut.[AuthenticationRetries]
, aut.[MarketName]
@vkhazin
vkhazin / DSE 4.8.9 on ubuntu 16.04
Last active September 20, 2017 14:23
Installing DSE Cassandra 4.8.9 on ubuntu 16.04
# Installing Java
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer -y
# Downloading
username='vladimir.khazin@icssolutions.ca'
curl -O -u $username 'https://downloads.datastax.com/enterprise/DataStaxEnterprise-4.8.9-linux-x64-installer.run'
# Installing
# Installing dependencies locally using terminal
```pip install module-name -t ./python_modules```
# Referencing locall dependencies in python module:
```
import sys
sys.path.insert(0, "./python_modules")
```
@vkhazin
vkhazin / gist:5b713e962af3341bbf6037b7807df389
Created October 28, 2017 13:58
Create MS Sql Login and grant database ownership role
USE <db name>
CREATE LOGIN <login name> WITH PASSWORD = '<password>'
create user <login name> for login <login name>
exec sp_addrolemember 'db_owner', '<db name>'
--https://blog.sqlauthority.com/2009/01/07/sql-server-find-currently-running-query-t-sql/
SELECT sqltext.TEXT,
req.session_id,
req.status,
req.command,
req.cpu_time,
req.total_elapsed_time
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
# NginX reverse proxy for jenkins: https://gist.github.com/rdegges/913102
FQDN="ec2-18-222-184-237.us-east-2.compute.amazonaws.com"
sudo apt install nginx -y
sudo rm /etc/nginx/sites-enabled/default
CONFIG="upstream kibana {
server $FQDN:5601 fail_timeout=0;
}