# 为虚拟网络接口 utun0 配置 IP 地址 10.0.0.33 和子网掩码 255.255.255.0 网关地址 10.0.0.1
sudo ifconfig utun0 10.0.0.33 10.0.0.1 netmask 255.255.255.0
# 配置目标地址是网段 192.168.1.0/24 的流量走 10.0.0.1 网关
sudo route add 192.168.1.0/24 10.0.0.1
# 将 6.11.20.10 这个单一地址(因为掩码是 32)路由到 192.168.4.1 这个网关
sudo route add 6.11.20.10/32 192.168.4.1
I use PostgreSQL via the psql client. If you use a different client (eg. pgAdmin, etc.), I don't know how much will translate over.
One nice difference between psql and mysql (cli) is that if you press CTRL+C, it won't exit the client.
psql -U postgres
const useFetch = (service) => { | |
const [loading, setLoading] = useState(true); | |
const [error, setError] = useState(); | |
const [data, setData] = useState(); | |
const fetchAPI = useCallback(async () => { | |
try { | |
const res = await fetch(service); | |
const json = await res.json(); | |
setData(json); |
#!/usr/bin/env pwsh | |
# https://stackoverflow.com/questions/8761888/capturing-standard-out-and-error-with-start-process | |
function Start-Command ([String]$Path, [String]$Arguments) { | |
$pinfo = New-Object System.Diagnostics.ProcessStartInfo | |
$pinfo.FileName = $Path | |
$pinfo.RedirectStandardError = $true | |
$pinfo.RedirectStandardOutput = $true | |
$pinfo.UseShellExecute = $false | |
$pinfo.Arguments = $Arguments |
So we we're using an API which returns a JSON response. One of its attributes is a numeric key. Due to historical reasons we're now being served longer number (longs) so the server, which is not based on JavaScript, started returning long integers.
I had heard about issues like this but hadn't cross against a real use case before.
So what started happening on our JavaScript clients (browser and React Native alike) is that the primitive value we get back once we get the fetch json promise resolved is an overflown number.
JavaScript engines commonly have the symbol Number.MAX_SAFE_INTEGER
so one can retrieve the number above which problems start to appear (it is 9007199254740991
).
private rule Macho | |
{ | |
meta: | |
description = "private rule to match Mach-O binaries (copied from Apple's XProtect)" | |
condition: | |
uint32(0) == 0xfeedface or uint32(0) == 0xcefaedfe or uint32(0) == 0xfeedfacf or uint32(0) == 0xcffaedfe or uint32(0) == 0xcafebabe or uint32(0) == 0xbebafeca | |
} | |
rule ZoomDaemon | |
{ |
// This injects a box into the page that moves with the mouse; | |
// Useful for debugging | |
async function installMouseHelper(page) { | |
await page.evaluateOnNewDocument(() => { | |
// Install mouse helper only for top-level frame. | |
if (window !== window.parent) | |
return; | |
window.addEventListener('DOMContentLoaded', () => { | |
const box = document.createElement('puppeteer-mouse-pointer'); | |
const styleElement = document.createElement('style'); |
# | |
# Install and configure 3proxy for Ubuntu 16.04 or Debian 9 | |
# | |
# Update the system and install build tools + fail2ban | |
apt update -y && apt upgrade -y && apt dist-upgrade -y | |
apt autoremove -y && apt autoclean -y && apt clean -y | |
apt -y install fail2ban software-properties-common | |
apt install -y build-essential libevent-dev libssl-dev |