Skip to content

Instantly share code, notes, and snippets.

View overdese's full-sized avatar
:octocat:
Remote work

Dmitry overdese

:octocat:
Remote work
View GitHub Profile
@scyto
scyto / docker-swarm-architecture.md
Last active July 20, 2024 19:17
My Docker Swarm Architecture
@mowings
mowings / cron_docker.md
Last active May 8, 2024 11:54
Run cron on docker with job output directed to stdout

You'd like a docker container that runs cron jobs, with the output of those cron jobs going to stdout so they are accessible as docker logs. How do you do that?

Install cron, and set it up to run in the foreground

In your Dockerfile, apt-get -y install cron Use apk or whatever if you are running on alpine or another distribution Set the command or entrypoint in your Dockerfile to run cron 9n the foreground

ENTRYPOINT ["/usr/sbin/cron", "-f"]
@dkt26111
dkt26111 / alert.rules.yml
Created June 6, 2019 18:32
High CPU usage alert rule for Prometheus
groups:
- name: example
rules:
# Alert for any cluster that has average CPU idle < 50%
- alert: HighUsage
expr: avg(irate(node_cpu_seconds_total{mode="idle"}[1m]) * 100) < 50
for: 1m
annotations:
summary: "High usage on {{ $labels.instance }}"
description: "{{ $labels.instance }} has a average CPU idle (current value: {{ $value }}s)"
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active July 23, 2024 00:25
set -e, -u, -o, -x pipefail explanation
@zmts
zmts / tokens.md
Last active July 22, 2024 18:25
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@biwin
biwin / community_to_shell.py
Last active January 12, 2024 10:53
Change PyCharm Community Python Console to PyCharm Professional Django Console (Django Shell)
# Change the run script on `settings> Build Execution and Deployment > Console > Python Console` to
# hoping you have your settings at project/project/settings.py (if not, change accordingly;)
import os,sys,django;sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])
os.environ['DJANGO_SETTINGS_MODULE'] = WORKING_DIR_AND_PYTHON_PATHS.split('/')[-1]+'.settings'
print('Python {0} on {1} using {2} as settings'.format(sys.version, sys.platform, os.environ['DJANGO_SETTINGS_MODULE']))
django.setup()
@oledid
oledid / turn-off-screen.ps1
Created September 24, 2015 07:15
PowerShell: Turn off computer screen
# Source: http://www.powershellmagazine.com/2013/07/18/pstip-how-to-switch-off-display-with-powershell/
# Turn display off by calling WindowsAPI.
# SendMessage(HWND_BROADCAST,WM_SYSCOMMAND, SC_MONITORPOWER, POWER_OFF)
# HWND_BROADCAST 0xffff
# WM_SYSCOMMAND 0x0112
# SC_MONITORPOWER 0xf170
# POWER_OFF 0x0002
@paskal
paskal / site.conf
Last active May 17, 2024 07:18 — forked from plentz/nginx.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null