Skip to content

Instantly share code, notes, and snippets.

cd /opt
wget http://apache-mirror.rbc.ru/pub/apache/kafka/0.10.1.0/kafka_2.11-0.10.1.0.tgz
tar xvzf kafka_2.11-0.10.1.0.tgz
ln -s kafka_2.11-0.10.1.0/ kafka
vi /etc/systemd/system/kafka-zookeeper.service
[Unit]
Description=Apache Zookeeper server (Kafka)
Documentation=http://zookeeper.apache.org
@nw4869
nw4869 / redis.service
Created May 24, 2018 09:42 — forked from matriphe/redis.service
Redis Systemd Service (Debian Based)
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
Type=forking
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/6379.conf
ExecStop=/usr/local/bin/redis-cli shutdown
@nw4869
nw4869 / AESCipher.py
Created May 9, 2018 02:44 — forked from crmccreary/AESCipher.py
Encryption using pycrypto, AES, and PKCS5 padding
from Crypto.Cipher import AES
from Crypto import Random
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
class AESCipher:
def __init__( self, key ):
"""
@nw4869
nw4869 / pycrypto_AES.py
Created May 3, 2018 08:29 — forked from komuw/pycrypto_AES.py
python AES with CBC/PKCS5Padding
from Crypto.Cipher import AES
from Crypto import Random
import base64
block_size = AES.block_size
#unpad = lambda s : s[0:-ord(s[-1])]
def pad(plain_text):
# 一键shadowsocks-libev + 锐速(自己换内核重启) + supervisor
sudo apt install software-properties-common -y
add-apt-repository ppa:max-c-lv/shadowsocks-libev
apt update
apt install shadowsocks-libev rng-tools -y
cat > /etc/shadowsocks-libev/config.json << EOF
{
"server":"0.0.0.0",
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChWdDv1Iv6yucLA96bTltTBLgqQx/WDq/MR6jiqytZCi0M66v67E/bFazqqLTqhkjkm52TO/LIMXpNGzyrfMIuPfIL1PbytKp7EY2auxmhaed7DmNcBoMH1JXpTaY0/V+/1lnTi5FY3YTkQ+0JXrJ+t3MMr8e0hZBbLosnl269jjXvWADlRE0B+8t+MMbkj8uycQ8ZQa4tJfZeT7waW5eByyE++lmQZHZqA64cUmxIRwcAjcNxvDxEtKDML9b7Kr0kvJprLkAzuPXYuumPXk5Jv+YSpwx5WXoFy6z1lwfjjayUDC2+43Xt8ht/mQD7xsuUvMgpD8E2pc+m0f4Puivp nightwind@Nights-MacBook-Pro.local
@nw4869
nw4869 / openssl.cnf
Created January 27, 2017 03:34
openssl.cnf
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
@nw4869
nw4869 / binarysearcha.cpp
Created April 6, 2016 11:03
二分查找
/*
lower_bound:Returns an iterator pointing to the first element in the range [first,last)
which does not compare less than val.
upper_bound:Returns an iterator pointing to the first element in the range [first,last)
which compares greater than val.
*/
#include <iostream>
#include <iterator>