Skip to content

Instantly share code, notes, and snippets.

@gunkaaa
gunkaaa / route_based_on_uid.sh
Last active September 6, 2023 00:25
Use separate gateway based on iptables owner (UID)
#!/bin/bash
# (In this case) default gateway is 192.168.1.3, alternate is 192.168.1.1.
# Usually default is either .1 or .254 - pay attention.
# If anything involving CDNs is involved, use https://github.com/hadess/resolvconf-override .
# Add new routing table, which uses alternate gateway by default
echo 100 altgateway >> /etc/iproute2/rt_tables
# Mark traffic sourced from UID as needing to go via other gateway (4 is arbitrary)
@gunkaaa
gunkaaa / opencl_env_vars.sh
Created February 20, 2018 09:42
opencl env vars
#!/bin/bash
export GPU_FORCE_64BIT_PTR=1
export GPU_MAX_HEAP_SIZE=100
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100
export GPU_SINGLE_ALLOC_PERCENT=100
0xf1A080065bFfe6b09cfF7055DA31303C3324251f
num value:DERIVE:0:U
requestlist value:GAUGE:0:U
recursion value:GAUGE:0:U
time value:DERIVE:0:U
#!/bin/bash
HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}"
INTERVAL="${COLLECTD_INTERVAL:-10}"
while sleep "$INTERVAL"; do
/usr/sbin/unbound-control stats | while read line;do
INSTANCE=`echo $line | cut -d= -f1 | cut -d. -f1`
STAT=`echo $line | cut -d= -f1 | cut -d. -f2- \
| sed 's/\./-/g' | sed 's/recursion-time-/recursion-time_/g' \
| sed 's/now/time-now/g' | sed 's/up/time-up/g' \
| sed 's/elapsed/time-elapsed/g' `