Skip to content

Instantly share code, notes, and snippets.

View zh4n7wm's full-sized avatar
🎯
Focusing

Hydra zh4n7wm

🎯
Focusing
View GitHub Profile
@zh4n7wm
zh4n7wm / systemd-tips.md
Created August 18, 2020 02:08
systemd tips

journal disk usage

check journal disk usage

journalctl --disk-usage

reduce journal size

@zh4n7wm
zh4n7wm / add-swap-file.md
Created July 17, 2020 02:02
add swap file

centos

#!/bin/bash

if [[ $UID -ne 0 ]]; then
    echo "please run this script with root"
    exit
fi
@zh4n7wm
zh4n7wm / psql-tips.md
Created May 18, 2020 07:29
psql tips

use vi mode editing in psql

~/.inputrc

set editing-mode vi
@zh4n7wm
zh4n7wm / nginx-tuning.md
Created April 8, 2020 03:12 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@zh4n7wm
zh4n7wm / yum-tips.md
Last active April 7, 2020 12:20
yum tips

Fix rpmdb: Thread died in Berkeley DB library

error message

rpmdb: Thread/process 277623/140429100390144 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.verbose.cli.yumcompletets:Yum Error: Error: rpmdb open failed
@zh4n7wm
zh4n7wm / graylog-tips.md
Last active September 8, 2020 01:18
graylog tips

ElasticSearch

Q: 通过 docker-compose 运行的 graylog 及 elasticsearch,如何进入 elasticsearch?

A:

sudo docker-compose exec elasticsearch bash

@zh4n7wm
zh4n7wm / README.md
Created January 11, 2020 02:59 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@zh4n7wm
zh4n7wm / mysql-load-data-local-infile.md
Last active December 11, 2019 03:38
[MySQL] load data local infile

错误信息

ERROR 1148: The used command is not allowed with this MySQL version

解决

修改 MySQL 配置文件

my.cnf 中的 [client][mysqld] 中增加 loose-local-infile=1

@zh4n7wm
zh4n7wm / disable.sh
Created November 22, 2019 07:25
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
@zh4n7wm
zh4n7wm / migrate-markdown-link-from-bitbucket-to-github.py
Created November 2, 2019 03:15
修复从 bitbucket 导入到 github wiki 中的 markdown link