Skip to content

Instantly share code, notes, and snippets.

View laudai's full-sized avatar

laudai

View GitHub Profile
@laudai
laudai / check-container.sh
Created May 1, 2018 11:34 — forked from hazbo/check-container.sh
A small script to remove (force) a container if it exists
#!/bin/bash
CONTAINER=$1
RUNNING=$(docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null)
if [ $? -eq 1 ]; then
echo "'$CONTAINER' does not exist."
else
/usr/bin/docker rm --force $CONTAINER
@laudai
laudai / check_docker_container.sh
Created May 1, 2018 12:40 — forked from ekristen/check_docker_container.sh
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@laudai
laudai / checkDockerDisks.sh
Created May 1, 2018 12:59 — forked from robsonke/checkDockerDisks.sh
This Bash script will loop through all running docker containers on a host and list the disk usage per mount. In case it's breaching the 65%, it will email you.
#!/bin/bash
# get all running docker container names
containers=$(sudo docker ps | awk '{if(NR>1) print $NF}')
host=$(hostname)
# loop through all containers
for container in $containers
do
echo "Container: $container"
@laudai
laudai / README.md
Created August 4, 2018 08:57 — forked from guillaumevincent/README.md
Windows Service with Python 3.5 and pyinstaller
@laudai
laudai / pysyslog.py
Created October 20, 2018 06:33 — forked from marcelom/pysyslog.py
Tiny Python Syslog Server
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'
@laudai
laudai / tmux-keybindings-overall.txt
Last active December 28, 2020 03:38
tmux 3.0a - keybindings
bind-key -T copy-mode C-Space send-keys -X begin-selection
bind-key -T copy-mode C-a send-keys -X start-of-line
bind-key -T copy-mode C-b send-keys -X cursor-left
bind-key -T copy-mode C-c send-keys -X cancel
bind-key -T copy-mode C-e send-keys -X end-of-line
bind-key -T copy-mode C-f send-keys -X cursor-right
bind-key -T copy-mode C-g send-keys -X clear-selection
bind-key -T copy-mode C-k send-keys -X copy-end-of-line
bind-key -T copy-mode C-n send-keys -X cursor-down
bind-key -T copy-mode C-p send-keys -X cursor-up
@laudai
laudai / tmux 3.0a-keybindings-useful-zh_TW.md
Last active January 1, 2021 17:00
tmux 3.0a-keybindings-useful-zh_TW

tmux 3.0a 常用快捷鍵中文版說明

是否需要Prefix 按鍵 英文指令 中文說明
C-b send-prefix 送出 prefix
c new-window 新增 window
d detach-client 暫時離開此 session
" split-window 水平切割 window
% split-window -h 垂直切割 window
n next-window 下一個 window
@laudai
laudai / guess_sequence.py
Last active April 2, 2021 16:06
Questen : feed a sequence, it will be an any sequence. Please answer the following 10 numbers.
#!/usr/bin/env python
# encoding: utf8
# Author : laudai
# codestyle : black
from typing import List, Tuple
import sys
"""
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# invoke insmod with all arguments we got
# and use a pathname, as insmod doesn't look in . by default
TARGET_PATH=$(find /lib/modules/$(uname -r)/kernel/drivers/net/ethernet -name realtek -type d)
if [ "$TARGET_PATH" = "" ]; then
TARGET_PATH=$(find /lib/modules/$(uname -r)/kernel/drivers/net -name realtek -type d)
fi
# SPDX-License-Identifier: GPL-2.0-only
################################################################################
#
# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free