Skip to content

Instantly share code, notes, and snippets.

@denji
denji / windows-keyboard-default-mode.md
Created Sep 29, 2020
Keyboard flags and indicators when start Windows 10
View windows-keyboard-default-mode.md

HKEY_USERS\.DEFAULT\Control Panel\Keyboard and edit the string value InitialKeyboardIndicators to one of the following values:

InitialKeyboardIndicators bitmask list:

  • 0 — turns off Scroll Lock, Num Lock, Caps Lock (default)
  • 1 — turn on Caps Lock
  • 2 — turn on Num Lock
  • 3 — turn on both Num Lock and Caps Lock
  • 4 — turn on Scroll Lock
  • 5 — turn on both Scroll Lock and Caps Lock
  • 6 — turn on both Scroll Lock and Num Lock
@denji
denji / postgresql90.md
Created Aug 27, 2020 — forked from kidpixo/postgresql90.md
PostgreSQL 9.0 cheatsheet from www.postgresonline.com
View postgresql90.md
@denji
denji / TrueColour.md
Created May 3, 2020 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@denji
denji / TrueColour.md
Created May 3, 2020 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@denji
denji / http_modules_ngx__http__slice_read_ahead.patch
Created Nov 4, 2019
http_modules_ngx__http__slice_read_ahead.c The existing slice module (https://nginx.org/en/docs/http/ngx_http_slice_module.html) only starts fetching a given slice whenever bytes in that range for that slice is requested. The patch allows you to configure a variable (slice_read_ahead X) which will cause nginx to start proactively reading X futur…
View http_modules_ngx__http__slice_read_ahead.patch
Index: Makefile
===================================================================
--- Makefile (revision 507358)
+++ Makefile (revision 507359)
@@ -74,7 +74,7 @@
HTTP_CACHE HTTP_DAV HTTP_FLV HTTP_GUNZIP_FILTER HTTP_GZIP_STATIC \
HTTP_IMAGE_FILTER HTTP_MP4 HTTP_PERL HTTP_RANDOM_INDEX HTTP_REALIP \
HTTP_REWRITE HTTP_SECURE_LINK HTTP_SLICE HTTP_SSL HTTP_STATUS HTTP_SUB \
- HTTP_XSLT HTTPV2 STREAM STREAM_SSL STREAM_SSL_PREREAD
+ HTTP_XSLT HTTPV2 STREAM STREAM_SSL STREAM_SSL_PREREAD HTTP_SLICE_AHEAD
@denji
denji / Shadowsocks_With_V2Ray.md
Created May 9, 2019 — forked from Prajwal-Koirala/Shadowsocks_With_V2Ray.md
Install Shadowsocks With V2Ray Manually
View Shadowsocks_With_V2Ray.md

Installing Packages

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y && sudo apt-get clean && sudo apt-get install build-essential haveged -y
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install shadowsocks-libev -y
sudo apt-get install cron -y
sudo apt-get install screen -y

Install V2Ray

View mysql-performance-tuning.sql
-- Query the database to calculate a recommended innodb_buffer_pool_size
-- and get the currently configured value
-- The rollup as the bottom row gives the total for all DBs on the server, where each other row is recommendations per DB.
SELECT
TABLE_SCHEMA,
CONCAT(CEILING(RIBPS/POWER(1024,pw)),SUBSTR(' KMGT',pw+1,1))
Recommended_InnoDB_Buffer_Pool_Size,
(
SELECT CONCAT(CEILING(variable_value/POWER(1024,FLOOR(LOG(variable_value)/LOG(1024)))),SUBSTR(' KMGT',FLOOR(LOG(variable_value)/LOG(1024))+1,1))
@denji
denji / colorfilters.txt
Created Feb 28, 2019
Wireshark troubleshooting colorfilters
View colorfilters.txt
@T-Small Window Sizes (<1320)@tcp.window_size < 1320 && tcp.window_size > 0@[65535,42405,0][0,0,0]
@T-Large Time Delay (>2 seconds)@frame.time_delta_displayed > 2.0@[65535,42405,0][0,0,0]
@T-DNS Error Responses@!dns.flags.rcode == 0 && dns.flags.response == 1@[42662,29041,4112][0,0,0]
@T-HTTP Error Response (>399)@http.response.code > 399@[65535,42405,0][0,0,0]
!@N-Window Update@expert.message == "Window update"@[0,25700,0][65535,65535,65535]
@I-SYN Packet@tcp.flags.syn == 1@[51657,2313,2313][65535,65535,65535]
@N-TCP Header > 20@tcp.hdr_len > 20@[0,25700,0][65535,65535,65535]
@denji
denji / NGINX-HTTP-Request-Stages.md
Last active Mar 26, 2021
NGINX HTTP Request Stages
View NGINX-HTTP-Request-Stages.md

NGINX actual HTTP Request processing flow is divided into 11 stages.

The reason for this division is to perform logical subdivision request to the module as a processing unit, the various stages can contain any number of HTTP modules and pipelined manner request.

The advantage of this is to make the process more flexible, reducing the degree of coupling.

These 11 HTTP stages are as follows:

  1. NGX_HTTP_POST_READ_PHASE ― The phase of the read request;
@denji
denji / resize-qemu-img
Created Dec 22, 2018 — forked from mortn/resize-qemu-img
online resize qemu image
View resize-qemu-img
F=/var/lib/libvirt/images/ubuntu.img
sudo qemu-img resize $F 50G
sudo virsh blockresize --path $F --size $(qemu-img info $F|sed -n '/virtual size/ s/^.*: //;s/(.*//p') <domain-id>