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 / bash_alias.example
Last active February 26, 2018 15:50
bash alias example
alias downloadtime='curl -s -w "%{time_total}\n" -o /dev/null $1'
alias pgoogle='ping google.com'
alias pindex='ping index.hu'
alias pdefroute='ping $(netstat -rn | grep "^0.0.0.0" | tr -s [:space:] | cut -f 2 -d " ")'
alias ifconfig-ext='host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has addres"'
alias mkdirdatetime='mkdir $(date +%Y%m%d-%H%M)'
alias showwifichannles='sudo iwlist wlp4s0 scan | grep Frequency | sort | uniq -c | sort -n'
sssh (){
if [ -n "$2" ]; then
@ricsiga
ricsiga / repcached-init.sh
Last active September 28, 2016 12:37
repcached init file and config file
#! /bin/sh
### BEGIN INIT INFO
# Provides: repcached
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: repcached - Memory caching daemon replicated
@ricsiga
ricsiga / kurento-media-server.service
Created August 18, 2016 15:19
Kurento media server systemd unit file example
[Unit]
Description=Kurento Media Server daemon
After=network.target
[Service]
ExecStart=/usr/bin/kurento-media-server
Type=simple
PIDFile=/var/run/kurento-media-server.pid
Restart=always
@ricsiga
ricsiga / catch_lid_open_events.md
Last active July 10, 2017 09:03
Catch lid open events on Ubuntu 16.04

create two files:

  • /etc/acpi/events/lm_lid
  • /etc/acpi/lid.sh (chmod +x /etc/acpi/lid.sh)

restart acpid service:

  • systemctl restart acpid.service
@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
@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 / 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 / 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 / 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 / apt.conf
Last active June 7, 2016 20:36
Debian Squeeze archive apt-get config
# /etc/apt/apt.conf
Acquire::Check-Valid-Until false;