Skip to content

Instantly share code, notes, and snippets.

View olegbuevich's full-sized avatar

Aleh Buyevich olegbuevich

View GitHub Profile
@olegbuevich
olegbuevich / start.sh
Created April 25, 2018 11:10
ubuntu 14.04 play framework init.d template
#!/bin/bash
### BEGIN INIT INFO
# Provides: ${{app_name}}
# Required-Start: ${{start_facilities}}
# Required-Stop: ${{stop_facilities}}
# Default-Start: ${{start_runlevels}}
# Default-Stop: ${{stop_runlevels}}
# Short-Description: ${{descr}}
### END INIT INFO
@olegbuevich
olegbuevich / .htaccess
Created January 17, 2018 14:25
.htaccess proxy nodejs app with websockets
# a2enmod proxy_wstunnel
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule ^(.*) ws://localhost:10081/$1 [P]
RewriteRule ^(.*) http://localhost:10081/$1 [P]

Keybase proof

I hereby claim:

  • I am olegbuevich on github.
  • I am obuevich (https://keybase.io/obuevich) on keybase.
  • I have a public key ASDbQbeXTGHIVaIkcqw2-FKcIi6b7jAZ1T-GF_yT1smfbgo

To claim this, I am signing this object:

@olegbuevich
olegbuevich / rocketchat.conf
Created July 21, 2017 14:06
upstart config for Rocket.Chat (work in Centos 6)
description "rocketchat application server"
# Wait for mongod before starting rocketchat app··
start on (started mongod)
stop on runlevel [!2345]
# Automatically attempt to restart with finite limits
respawn
respawn limit 99 5
@olegbuevich
olegbuevich / sent_tg_msg.py
Created May 23, 2017 08:52
[python] send message to telegram chat from bot
# pip install python-telegram-bot
from telegram import bot
# example values
BOT_TOKEN='123456789:jhsagdhg_sakjdKHGKuyasgdkhsabdas'
CHAT_ID='7125376'
tbot = bot.Bot(BOT_TOKEN)
tbot.send_message(chat_id=CHAT_ID, text='Message from python')
@olegbuevich
olegbuevich / ssl_cert_to_rtN66u.sh
Created May 12, 2017 09:32
update letsencrypt cert on asus RT-N66U
sudo cat /etc/letsencrypt/live/<hostname>/privkey.pem | ssh <router> "cat > /etc/key.pem"
sudo cat /etc/letsencrypt/live/<hostname>/fullchain.pem | ssh <router> "cat > /etc/cert.pem"
ssh <router> service restart_httpd
@olegbuevich
olegbuevich / tomcat8
Created March 28, 2017 10:47
tomcat 8 init.d script (based on script from tomcat8 package from ubuntu 16.04)
#!/bin/sh
#
# /etc/init.d/tomcat8 -- startup script for the Tomcat 8 servlet engine
#
# Written by Miquel van Smoorenburg <[email protected]>.
# Modified for Debian GNU/Linux by Ian Murdock <[email protected]>.
# Modified for Tomcat by Stefan Gybas <[email protected]>.
# Modified for Tomcat6 by Thierry Carrez <[email protected]>.
# Modified for Tomcat7 by Ernesto Hernandez-Novich <[email protected]>.
# Additional improvements by Jason Brittain <[email protected]>.
@olegbuevich
olegbuevich / upgrade.sh
Last active December 13, 2017 12:56
duplicity 0.7 centos 6
# install needed packages
yum install librsync-devel python-devel
# remove old version
yum remove duplicity.x86_64
wget http://savannah-nongnu-org.ip-connect.vn.ua/duplicity/duplicity-0.7.11.tar.gz
tar -zxvf duplicity-0.7.11.tar.gz
cd duplicity-0.7.11/
python setup.py install
@olegbuevich
olegbuevich / mattermost.conf
Created March 24, 2017 11:09
centos 6 upstart config for mattermost
start on runlevel [2345]
stop on runlevel [016]
respawn
limit nofile 50000 50000
chdir /opt/mattermost
exec su -c bin/platform mattermost
@olegbuevich
olegbuevich / pg_stat_statements
Created September 30, 2016 09:23
Postgresql pg_stat_statements
SELECT query, calls, total_time, rows, 100.0 * shared_blks_hit /
nullif(shared_blks_hit + shared_blks_read, 0) AS hit_percent
FROM pg_stat_statements ORDER BY total_time DESC LIMIT 5;