Skip to content

Instantly share code, notes, and snippets.

View kapb14's full-sized avatar
😤

Aleksandr Karushin kapb14

😤
View GitHub Profile
@kapb14
kapb14 / README.md
Last active December 20, 2021 20:12
Nginx HTTP status code monitoring with Zabbix and Lua
  1. нужен LUA модуль для Nginx, он есть в репах Debian

apt-get install nginx-extras

  1. используется lua скрипт для мониторинга Nginx при помощи prometheus (а че - он удобный вполне)
mkdir /etc/nginx/lua
git clone https://github.com/knyar/nginx-lua-prometheus /etc/nginx/lua/nginx-lua-prometheus
@kapb14
kapb14 / Dockerfile
Created June 18, 2018 11:24
Dante proxy with docker-compose setup
FROM vimagick/dante
ARG proxy_user
ARG proxy_pass
ADD ./sockd.conf /etc/sockd.conf
RUN echo "\n\tCreating a new user for proxy\n\t\tusername: $proxy_user\n\t\tpassword: $proxy_pass\n\n" \
&& useradd $proxy_user \
&& echo $proxy_user:$proxy_pass | chpasswd
EXPOSE 3333
@kapb14
kapb14 / .snippets.bash
Last active June 16, 2018 16:45
Some useful bash snippets
# current script base name
SCRIPTNAME=$(basename $0)
# get full path to directory where THIS script placed
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@kapb14
kapb14 / upgrade-nodejs-version.sh
Created June 16, 2018 16:40
upgrade nodejs and npm version with "n"
#!/bin/bash
check_ver(){
node --version
npm --version
}
check_ver
npm cache clean -f
npm update npm -g
npm install -g n
@kapb14
kapb14 / wget_fetch_repo.sh
Created June 16, 2018 16:39
wget: recursively download packages from repository
#!/bin/bash
##
## wget -r -np -nH –cut-dirs=3 -R index.html http://hostname/aaa/bbb/ccc/ddd/
## Explanation:
## It will download all files and subfolders in ddd directory:
## recursively (-r),
## not going to upper directories, like ccc/… (-np),
## not saving files to hostname folder (-nH),
## but to ddd by omitting first 3 folders aaa, bbb, ccc (–cut-dirs=3),
## excluding index.html files (-R index.html)
@kapb14
kapb14 / nginx-purge-cache
Created June 15, 2018 19:14
Purge nginx proxy_cache and restart it
#!/bin/bash
set -e
nginx -t
echo " remove all subdirectories of nginx proxy_cache_path"
for dir in $(nginx -T 2>&1 | grep proxy_cache_path | awk $'{print $2}'); do
rm -rf ${dir}/*
done
echo " restart nginx daemon"
service nginx restart
@kapb14
kapb14 / selenium.service
Created June 15, 2018 17:17
Selenium Standalone Server as a systemd Service
# /etc/systemd/system/selenium.service
[Unit]
Description=Selenium Standalone Server
Requires=xvfb.service
After=xvfb.service
[Service]
Type=simple
@kapb14
kapb14 / README.md
Last active July 12, 2017 12:31
My ZSH Theme — Clean Mod

My modified fork of clean.zsh-theme

  • simple and clean!
  • fast
  • works on default zsh settings

Setup

Just add to your ~/.zshrc following lines:

@kapb14
kapb14 / python_json_pretty_print.sh
Last active June 29, 2017 12:13 — forked from phyous/install_simple_pretty_print.sh
An useful alias to enable simple pretty printing of json data with builtin python module.
# Add alias to bash shell
echo "alias json='python -mjson.tool'" >> ~/.bashrc
# Add alias for zsh shell
echo "alias json='python -mjson.tool'" >> ~/.zshrc
@kapb14
kapb14 / nginx.conf
Created June 27, 2017 16:16 — forked from phpdude/nginx.conf
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;