Skip to content

Instantly share code, notes, and snippets.

@xmeng1
xmeng1 / wsl2-network.ps1
Created July 14, 2019 06:50
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@pdfruth
pdfruth / defconfig-roc-rk3328-cc-with-docker
Last active July 27, 2023 05:24
roc-rk3328-cc kernel config with docker support
CONFIG_DEFAULT_HOSTNAME="localhost"
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_FHANDLE=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_SCHED_WALT=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
@muink
muink / SSD-write-optimize-and-cache-user-data-path-custom-for-chrome.md
Last active January 10, 2025 05:01
SSD写入优化与Chrome 自定义缓存/用户数据路径

SSD写入优化与Chrome 自定义缓存/用户数据路径

随着大容量消费级SSD的普及,更多的用户选择使用SSD作为系统盘或程序盘 而在享受急速体验的同时,一小部分人认识到了SSD的寿命=容量*P/E次数=总可写入量 于是各种减少写入优化SSD的文章也如雨后春笋后冒了出来,虽有一定借鉴意义,可过于极端的配置却导致一定的易用性缺失 用户应该根据自己SSD的实际情况,有选择的进行优化

1. 首先了解自己SSD的容量颗粒介质可写入总量(TBW)

  • 通常SSD的总可写入量(TBW)=容量*可P/E总数,也有些厂商会标注出产品的TBW以方便用户查询
  • 对于使用SLC介质的SSD(例如Intel企业级)通常其P/E总数在100000次以上,即使64G的容量也有6250TBW的可写入量
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
sudo vi /etc/sysctl.conf
# Add the following to sysctl.conf:
# Decrease TIME_WAIT seconds
net.ipv4.tcp_fin_timeout = 30
# Recycle and Reuse TIME_WAIT sockets faster
net.ipv4.tcp_tw_recycle = 1
@kimus
kimus / ufw.md
Created March 2, 2014 22:46
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@azbesthu
azbesthu / get-kernel-source.sh
Last active July 3, 2020 12:01
get kernel source for current rpi raspbian wheezy kernel
#!/bin/bash
REV=`zcat /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz | grep '* firmware as of' | head -n 1 | sed -e 's/\ \*\ firmware as of \(.*\)$/\1/'`
rm -rf rasp-tmp
mkdir -p rasp-tmp
mkdir -p rasp-tmp/linux
wget https://raw.github.com/raspberrypi/firmware/$REV/extra/git_hash -O rasp-tmp/git_hash
wget https://raw.github.com/raspberrypi/firmware/$REV/extra/Module.symvers -O rasp-tmp/Module.symvers