Skip to content

Instantly share code, notes, and snippets.

View Ara4Sh's full-sized avatar

Arash Shams Ara4Sh

View GitHub Profile
LB_name = 'HA_Servers'
LB_user = 'root'
LB_hosts = ['node1','node2']
LB_mapping = {
'node1': ('172.20.4.40'),
'node2': ('172.20.4.49')
}
HA_maxconn = '20000'
HA_bind_ip = '172.20.4.50:80'
import telegram
def main():
bot = telegram.Bot(token="113351444:AAGmDDOkLqvzCESShVAfzwBgLiT1R9UvUK0")
lui = bot.getUpdates()[-1].update_id
print lui
while True:
for updates in bot.getUpdates(offset=lui,timeout=10):
text = updates.message.text
chat_id = updates.message.chat.id
update_id = updates.update_id
@Ara4Sh
Ara4Sh / Vagrantfile
Created November 7, 2015 08:37
Docker Vagrant
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
CNT_NAME = "dckt-bsf"
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'
require 'yaml'
containers = YAML.load_file('containers.yml')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.username = "root"
config.ssh.private_key_path = "/home/araax/.ssh/id_rsa"
config.ssh.pty= true
#!/bin/bash
# Copyright (C) 2015 Arash Shams <xsysxpert@gmail.com>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@Ara4Sh
Ara4Sh / cf-ddns.sh
Created August 28, 2016 08:53 — forked from larrybolt/cf-ddns.sh
Automatically update your CloudFlare DNS record to the IP, Dynamic DNS for Cloudflare
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# Automatically update your CloudFlare DNS record to the IP, Dynamic DNS
# Can retrieve cloudflare Domain id and list zone's, because, lazy
# Place at:
# /usr/local/bin/cf-ddns.sh
@Ara4Sh
Ara4Sh / cloudflare-failover.sh
Created October 12, 2016 13:49
CloudFlare A records failover script using CloudFlare api v4 (https://api.cloudflare.com) required jq and curl to run.
#!/bin/bash
# Copyright (C) 2016 Arash Shams <https://github.com/Ara4Sh>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@Ara4Sh
Ara4Sh / gist:4d0c05075d1b956c06f92d70bb384cf7
Created November 26, 2016 06:54
debian-openresty-vts module with create .deb package
#Installing openresty 1.11.2.2 on debian 8
#Install required packages
apt-get -y install build-essential libpcre3-dev libssl-dev libgeoip-dev nginx libpq-dev libxslt1-dev libgd2-xpm-dev luajit git checkinstall
#Download openresty
cd /usr/local/src
wget https://openresty.org/download/openresty-1.11.2.2.tar.gz
tar xzf openresty-1.11.2.2.tar.gz
cd openresty-1.11.2.2
@Ara4Sh
Ara4Sh / gist:863e4796801f0453460faddb78e0ea62
Created March 26, 2017 07:51
Nginx Redirect if useragent is android or iphone
# 1
location / {
set $mobile 0;
if ($http_user_agent ~* "iphone|android") {
set $mobile 1;
}
if ($mobile = 1) {
# return or rewrite to somewhere
}
}
@Ara4Sh
Ara4Sh / gist:96c5513068f750891d23874ec95ef408
Created July 24, 2017 03:37
Using mysql.cnf again in percona 5.7
rm -rf /etc/my.cnf
update-alternatives --install /etc/mysql/my.cnf my.cnf "/etc/mysql/percona-server.cnf" 200
8.2.3. HTTP log format
----------------------
The HTTP format is the most complete and the best suited for HTTP proxies. It
is enabled by when "option httplog" is specified in the frontend. It provides
the same level of information as the TCP format with additional features which
are specific to the HTTP protocol. Just like the TCP format, the log is usually
emitted at the end of the session, unless "option logasap" is specified, which
generally only makes sense for download sites. A session which matches the
"monitor" rules will never logged. It is also possible not to log sessions for