Skip to content

Instantly share code, notes, and snippets.

@xman1980
xman1980 / gist:6617edd15de6ef21f220071183fd2e15
Created March 13, 2018 20:14
sort running yarn applications
yarn application -list -appStates RUNNING | cut -f 2 | sort | uniq -c
#!/bin/sh
sql_host=""
sql_user=""
sql_passwd=""
sql_db=""
sql_opts="--routines --add-drop-table --add-locks --create-options --single-transaction --disable-keys --extended-insert --quick"
sql_bk_directory=""
sql_bk_password=""
@xman1980
xman1980 / gist:8a8e024a132ed0f7e8d52e1d974832d5
Last active May 16, 2018 18:16
letsencrypt certbot wildcard
certbot certonly --manual -d domain.info -d *.domain.info --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory
@xman1980
xman1980 / gist:2a16343d459ec74b40c7cc30d5994b08
Created May 14, 2018 10:26
hadoop balancer settings tuning
Recommended Configurations
This section provides recommended configurations for Background and Fast modes.
The HDFS Balancer can run in either Background or Fast modes.
Background Mode
HDFS Balancer runs as a background process. The cluster serves other jobs and applications at the same time.
Fast Mode
HDFS Balancer runs at maximum (fast) speed.
@xman1980
xman1980 / dump_cloudera_manager.py
Created June 11, 2018 08:04 — forked from sit/dump_cloudera_manager.py
A quick and dirty script to dump the cluster/service/role configuration via the Cloudera Manager API http://cloudera.github.io/cm_api/.
#!/usr/bin/env python
from cm_api.api_client import ApiResource
def main(args):
cm_host = get(args, 1, "localhost")
cm_user = get(args, 2, "admin")
cm_pass = get(args, 3, "admin")
api = ApiResource(cm_host, username=cm_user, password=cm_pass)
tail -f /var/log/nginx/nginx.access.log | cut -d ' ' -f 1 | logtop
Покажет (и будет обновляться в режиме реального времени) что-то вроде:
3199 elements in 27 seconds (118.48 elements/s)
1 337 12.48/s 95.65.66.183
2 308 11.41/s 122.29.177.10
3 304 11.26/s 122.18.251.54
4 284 10.52/s 92.98.80.164
5 275 10.19/s 188.239.14.134
cat log | awk '{print $1}' | sort | uniq -c | awk '{if($1>50){print $1 " " $2}}' | awk '{print $2}' > /tmp/ips
#!/bin/bash
#
#########################################################################
#This software code is made available "AS IS" without warranties of any #
#kind. You may copy, display, modify and redistribute the software #
#code either by itself or as incorporated into your code; provided that #
#you do not remove any proprietary notices. Your use of this software #
#code is at your own risk and you waive any claim against Amazon #
#Digital Services, Inc. or its affiliates with respect to your use of #
#this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its #
@xman1980
xman1980 / ip-down
Created June 25, 2018 07:10 — forked from copiousfreetime/ip-down
PPP ip-up/ip-down for vpn with optional dns resolving
#!/bin/sh
# install into /etc/ppp/ip-down
# chmod a+x /etc/ppp/ip-down
source /etc/ppp/ip.config
case "${IPREMOTE}" in
${MY_IPREMOTE})
/sbin/route delete ${MY_ROUTE} -interface ${IFNAME}
sed -i "s/.*PasswordAuthentication.*/PasswordAuthentication yes/g" /etc/ssh/sshd_config && service sshd restart