Skip to content

Instantly share code, notes, and snippets.

View CraKeyBoy's full-sized avatar
💭
I may be slow to respond.

CraKeyBoy CraKeyBoy

💭
I may be slow to respond.
View GitHub Profile
@CraKeyBoy
CraKeyBoy / synology-drive-hack.sh
Created December 22, 2024 16:54 — forked from KirovAir/synology-drive-hack.sh
Synology DS216+II eSata as a volume on DSM 7.2
# THANKS TO:
# https://www.casler.org/wordpress/synology-ssd-cache-on-external-devices/
# https://www.youtube.com/watch?v=KvW6LRw1RZs
# THESE ARE THE synoinfo.conf CHANGES I MADE:
# DEFAULT:
maxdisks="2"
internalportcfg="0x3" # 0000 0011
esataportcfg="0x4" # 0000 0100
@CraKeyBoy
CraKeyBoy / IntelliJ IDEA.app.vmoptions
Created November 30, 2023 03:35 — forked from gaplo917/IntelliJ IDEA.app.vmoptions
IntelliJ IDEA Java 17 ZGC VM Options
# Personal Feeling: using the following jvm config is smoother than default
# My Machine: Macbook pro M1max 64GB
# More Info: https://github.com/FoxxMD/intellij-jvm-options-explained
# Prerequisite (Intellij < 2022.2)
# 1. Install JetBrain Runtime 17 osx-aarch64 for Apple Silicon, https://github.com/JetBrains/JetBrainsRuntime/releases
# 2. Switch the runtime from JetBrain Runtime 11 to 17, https://www.jetbrains.com/help/idea/switching-boot-jdk.html
# JetBrain Toolbox
@CraKeyBoy
CraKeyBoy / SetTorIPExpireTime.md
Created March 14, 2023 01:39 — forked from NullPointerMaker/SetTorIPExpireTime.md
设置 Tor 出口 IP 的时效

网上有很多文章说 Tor 配置文件 torrc 里的 MaxCircuitDirtiness 参数是更换 IP 的间隔。这是不对的。
https://2019.www.torproject.org/docs/tor-manual.html 写得很清楚,是链路是否重用的间隔。它们不一样。

在使用 Tor 时,Tor 会建立有入口节点有中间节点有出口节点的链路。而在已经建立链路的情况下,客户端新发起的请求会重用这个链路。
MaxCircuitDirtiness 参数的作用是设置链路在多久后不再受理新的请求。但请注意,如果这个链路上旧的请求尚未结束,例如长轮询、WebSocket,那么过期后它也不会断开,只是不再被新的请求使用。因此,会发生一直不更换链路的情况。

更换 IP,也就是更换出口节点。限制它的频率参数是 TrackHostExitsTrackHostExitsExpire
其中前者设置哪些域名、IP 需要控制节点时限。

@CraKeyBoy
CraKeyBoy / answerfile
Created August 5, 2022 05:56 — forked from oofnikj/answerfile
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"
@CraKeyBoy
CraKeyBoy / nginx ip_hash策略
Created April 15, 2022 05:51 — forked from banjin/nginx ip_hash策略
在工作中经常使用Nginx的IP_hash策略做负载均衡,所以记录一下使用中的疑惑。
当对后端的多台动态应用服务器做负载均衡时,ip_hash指令能够将某个客户端IP的请求通过哈希算法定位到同一台后端服务器上。这样,当来自某个IP的用户在后端Web服务器A上登录后,再访问该站点的其他URL,能够保证其访问的还是后端Web服务器A。
如果不采用ip_hash指令,假设来自某个IP的用户在后端Web服务器A上登录后,再访问该站点的其他URL,有可能被定向到后端Web服务器B,C...上,由于用户登录后SESSION信息是记录在服务器A上的,B,C...上没有,这时就会提示用户来登录
在ip_hash策略中,它选择最初的server的方法是根据请求客户真个IP计算出一个哈希值,再根据哈希值选择后台的服务器。
1)由IP计算哈希值的算法如下, 其中公式中hash初始值为89,iphp->addr[i]表示客户真个IP, 通过三次哈希计算得出一个IP的哈希值:
  for (i = 0; i < 3; i++) {
  hash = (hash * 113 + iphp->addr[i]) % 6271;
@CraKeyBoy
CraKeyBoy / mac-cheatsheet.markdown
Created March 13, 2021 10:58 — forked from Muscliy/mac-cheatsheet.markdown
你每天都在使用的 Mac 键盘,其实还暗藏了这些秘密

这些技巧,能让工作效率更上一个台阶

键盘,可以算是最传统的输入设备之一。在计算机尚未诞生时,就已被广泛地用在打字机上。即使是在交互方式不断突破的今天,没人能够否认,传统的键盘依然处在人机交互的中心地位。我们使用电脑的绝大部分时间都是在敲击键盘中度过的,键盘使用的熟练度和舒适度直接影响着工作效率。因此,了解、熟练使用、甚至根据个体需求改造键盘,往往能够极大的提升工作效率。在本文中,笔者将将结合自己的使用经验,探讨一些能够提升 macOS 系统的键盘使用效率的方法与技巧。

被遗忘的 Control (⌃) 与 Option (⌥)

几乎所有对 macOS 系统有一定了解的用户都知道,macOS 的系统快捷键是以 Command (⌘) 为中心的。实际上,Control 键和 Option 键也暗藏不少秘密。

Control (⌃)

@CraKeyBoy
CraKeyBoy / Activate Office 2019 for macOS VoL.md
Created July 2, 2020 07:23 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@CraKeyBoy
CraKeyBoy / README.md
Created May 8, 2020 15:24 — forked from chuyik/README.md
macOS 给 Git(Github) 设置代理(HTTP/SSH)
@CraKeyBoy
CraKeyBoy / PoolSizeCalculator.java
Created January 19, 2020 10:11
A class that calculates the optimal thread pool boundaries. It takes the desired target utilization and the desired work queue memory consumption as input and retuns thread count and work queue capacity.
/**
* A class that calculates the optimal thread pool boundaries. It takes the desired target utilization and the desired
* work queue memory consumption as input and retuns thread count and work queue capacity.
*
* @author Niklas Schlimm
*
*/
public abstract class PoolSizeCalculator {
/**

MySQL Download URL

https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

Open the terminal and follow along:

  • Uninstall any existing version of MySQL
sudo rm /var/lib/mysql/ -R