Skip to content

Instantly share code, notes, and snippets.

View ricsiga's full-sized avatar

Richárd Tóth ricsiga

View GitHub Profile
@ricsiga
ricsiga / repcached.service
Created May 4, 2016 11:57
repcached systemd unit file example
[Unit]
Description=repcached - add data replication feature to memcached 1.2.x
After=network.target
[Service]
ExecStart=/opt/repcached/bin/memcached -m 256 -p 11211 -u root -P /var/run/memcachedrep.pid -x 1.2.3.4 -d
Type=forking
PIDFile=/var/run/memcachedrep.pid
Restart=always
@ricsiga
ricsiga / varnish_redirect_example.vcl
Last active November 30, 2019 17:46
redirect in Varnish 4
sub vcl_recv {
if (req.http.host == "www.example.com") {
set req.http.location = "http://example.com" + req.url;
return (synth(750, "Permanently moved"));
}
}
sub vcl_synth {
if (resp.status == 750) {
set resp.http.location = req.http.location;
@ricsiga
ricsiga / lxc-debian.sh
Last active May 26, 2016 13:08
create debian lxc container without systemd
#!/bin/bash
#
# lxc: linux Container library
# Authors:
# Daniel Lezcano <[email protected]>
# Modified:
# Claudio Kuenzler
@ricsiga
ricsiga / nginx_virtual_document_root.conf
Last active November 23, 2022 14:19
virtual document root for Nginx
# [0-9].example.com -> /srv/tickets.example.com/[0-9]/app/build
# http://nginx.org/en/docs/http/server_names.html
server {
listen 80;
server_name "~^(?<subdomain>^\d).example.com$";
root /srv/tickets.example.com/$subdomain/app/build;
}
@ricsiga
ricsiga / apt.conf
Last active June 7, 2016 20:36
Debian Squeeze archive apt-get config
# /etc/apt/apt.conf
Acquire::Check-Valid-Until false;
@ricsiga
ricsiga / delete_old_filebeat_indices.sh
Created June 20, 2016 13:36
delete old filebeat indices from elasticsearch
#!/bin/bash
index=$(date --date='14 days ago' +%Y.%m.%d)
curl -s -XDELETE "http://localhost:9200/filebeat-$index?pretty"
@ricsiga
ricsiga / set_date_time.sh
Created June 20, 2016 13:38
set the date and time via NTP
#!/bin/sh
/usr/sbin/ntpdate -s 0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
@ricsiga
ricsiga / logrotate_turnserver.conf
Created July 7, 2016 13:24
logrotate for turnserver
# /etc/logrotate.d/turnserver
/var/log/turnserver.log {
daily
rotate 14
compress
missingok
notifempty
create 644 root root
su root root
@ricsiga
ricsiga / turnserver.conf
Created July 7, 2016 13:27
coturn turnserver config
# /etc/turnserver.conf
external-ip=11.22.33.44/10.0.0.44
tls-listening-port=443
listening-port=443
min-port=49152
max-port=65535
verbose
lt-cred-mech
user=demo:asdf1234
@ricsiga
ricsiga / turnserver.service
Created July 29, 2016 13:42
turnserver systemd unit file example
[Unit]
Description=turnserver - coturn TURN server
After=network.target
[Service]
ExecStart=/usr/local/bin/turnserver -c /etc/turnserver.conf -o --no-stdout-log
Type=forking
PIDFile=/var/run/turnserver.pid
Restart=always