Skip to content

Instantly share code, notes, and snippets.

@kenshin17
kenshin17 / rules-both.iptables
Created September 13, 2017 06:11 — forked from jirutka/rules-both.iptables
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <[email protected]>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@kenshin17
kenshin17 / 1. Install Redis
Created December 21, 2017 09:47 — forked from pbolduc/1. Install Redis
Install redis on CentOS 7
# see How to Install Redis Server on CentOS 7 - http://linoxide.com/storage/install-redis-server-centos-7/
# --- Compiling ---
$ yum install gcc make tcl
$ REDIS_VER=3.2.3
$ wget http://download.redis.io/releases/redis-$REDIS_VER.tar.gz
$ tar xzvf redis-$REDIS_VER.tar.gz
$ cd redis-$REDIS_VER
$ make
$ make test
@kenshin17
kenshin17 / Documentation.md
Last active March 2, 2018 05:08 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@kenshin17
kenshin17 / ssl.conf
Created March 12, 2018 10:17 — forked from VirtuBox/ssl.conf
Nginx SSL/TLS configuration with TLSv1.2 and TLSv1.3 - ECDHE and strong ciphers suite
##
# SSL Settings
##
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-256-GCM-SHA384:TLS13-AES-128-GCM-SHA256:EECDH+CHACHA20:EECDH+AESGCM';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 15m;
ssl_session_tickets off;
@kenshin17
kenshin17 / install-ndppd-active-ipv6-subnet.sh
Last active October 9, 2024 11:27
Script install NDP Proxy Daemon, active full subnet ipv6.
#!/bin/bash
# Author: kenshin17
# OS: Centos 7
# Description: Script install NDP Proxy Daemon, active full subnet ipv6.
IPv6SUBNET="xxxx:xxxx:xxxx:xxxx::/64"
echo "######################## CONFIG SYSCTL #########################"
echo "net.ipv6.conf.all.accept_ra = 2" >> /etc/sysctl.conf
echo "net.ipv6.conf.eth0.accept_ra = 2" >> /etc/sysctl.conf
@kenshin17
kenshin17 / install-rabbitmq.sh
Created September 17, 2018 03:34 — forked from yetanotherchris/install-rabbitmq.sh
RabbitMQ on Docker with admin UI
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
#!/bin/bash
ping_ip()
{
IP=$1
ping $1 -c 1 >/dev/null 2>&1
if [ $? = 1 ]
then
echo "$1 is down"
fi
@kenshin17
kenshin17 / compile-haproxy-with-lua-openssl-ubuntu1804.sh
Last active September 11, 2019 11:22
Compile HAProxy 1.9.6 with Lua 5.3.5 and OpenSSL 1.1.0h and multithreading support on Ubuntu 18.04.2 LTS
#!/bin/bash
# Author : kenshin17
# OS : Ubuntu 18.04.2 LTS
# LastUpdate : 11:55 2019.05.13
# Description : Compile HAProxy 1.9.6 with Lua 5.3.5 and OpenSSL 1.1.0h and multithreading support on Ubuntu 18.04.2 LTS
###########################################
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
SETUP_DIR_WORKSPACE="/opt/setup"
@kenshin17
kenshin17 / kafka-cheat-sheet.md
Created May 30, 2019 03:19 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@kenshin17
kenshin17 / ssh_login_alert_telegram.sh
Last active July 6, 2019 04:48
SSH login alert via Telegram
#!/bin/bash
#File: /etc/profile.d/ssh_login_alert.sh
##################################
#wget https://raw.githubusercontent.com/xxxx -O /etc/profile.d/ssh_login_alert
#chmod +x /etc/profile.d/ssh_login_alert
##################################
USERID="xxx"
KEY="xxx:xx-xx"