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 / 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 / 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 / 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 / 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 / squeeze.dockerfile
Last active September 7, 2022 06:27
Debian Squeeze Dockerfile example
FROM debian:squeeze
RUN echo "deb http://archive.debian.org/debian squeeze main" > /etc/apt/sources.list
RUN echo "deb http://archive.debian.org/debian squeeze-lts main" >> /etc/apt/sources.list
RUN echo "Acquire::Check-Valid-Until false;" > /etc/apt/apt.conf
RUN apt-get update
RUN apt-get install -y --force-yes procps vim nano tmux curl
CMD ["/bin/bash"]
@ricsiga
ricsiga / crontab
Last active April 28, 2017 13:38
letsencrypt nginx redirect
# renew letsenrcypt cert
30 2 * * 1 /usr/bin/letsencrypt renew >> /var/log/le-renew.log
35 2 * * 1 /bin/systemctl reload nginx
@ricsiga
ricsiga / kibana.service
Created January 20, 2017 16:22
kibana systemd service file
[Unit]
Description=Kibana
After=network.target
[Service]
ExecStart=/workspace/kibana/bin/kibana
Type=simple
PIDFile=/var/run/kibana.pid
Restart=always
@ricsiga
ricsiga / Dockerfile
Last active April 5, 2017 15:14
Build and install latest netdata (https://my-netdata.io/)
FROM ubuntu:16.04
# System upgrade
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get upgrade -y
# Install packages and build netdata
RUN apt-get install -y zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl
@ricsiga
ricsiga / installNetdataWithAnsible.sh
Last active August 16, 2024 09:34
install Netdata with Ansible
#!/usr/bin/env bash
ansible -s -i inventoryFile -m shell -a "curl -Ss -o kickstart-static64.sh https://my-netdata.io/kickstart-static64.sh" all
ansible -s -i inventoryFile -m shell -a "chmod 750 kickstart-static64.sh" all
ansible -s -i inventoryFile -m shell -a "./kickstart-static64.sh --non-interactive" all
@ricsiga
ricsiga / lock.sh
Last active September 9, 2020 21:02
BASH lock file example
#!/usr/bin/env bash
set -e
lockFile="/var/tmp/app.lock"
if ( set -o noclobber; echo "locked" > "$lockFile") 2> /dev/null; then
trap 'rm -f "$lockFile"; exit $?' INT TERM EXIT
else
echo "Can't get file lock, $(basename "$0") already running" >&2