Skip to content

Instantly share code, notes, and snippets.

@rkfg
rkfg / pickpoint.sh
Last active May 16, 2018 10:31
Torrefacto Pickpoint delivery tracking
#!/bin/sh
PAGE=$( wget -qO- --post-data="shop=5742011_923%2C1979335517_923%2C1262625646_923&order_number=$1" https://pickpoint.ru/monitoring/msearch.php )
echo "$PAGE" | sed -n 's#.*\(Текущий статус :[^<]*\).*#\1#p'
PARAMS=$(echo "$PAGE" | sed -n 's#.*onclick="monitoring.show_history(&quot;\([0-9]*\)&quot;, &quot;\([0-9]*\)&quot.*#id=\1\&owner_id=\2#p')
wget -qO- "https://pickpoint.ru/monitoring/mhistory.php?$PARAMS" | sed -n 's#.*<tr><td>\([^<]*\)</td><td>\([^<][^<]*\)</td></tr>.*#\1 — \2\n#gp'
@rkfg
rkfg / test_fs.cpp
Created May 17, 2018 08:09
Read-only FUSE filesystem in C++
#include <iostream>
#include <cstring>
#include <unordered_map>
#include <memory>
#include <boost/unordered_map.hpp>
#define FUSE_USE_VERSION 26
#define _FILE_OFFSET_BITS 64
#include <fuse.h>
@rkfg
rkfg / switchdisplay.sh
Created September 3, 2018 11:17
Display switcher
#!/bin/sh
DISPLAY=:0
MAIN=DVI-D-0
TV=HDMI-0
if xrandr --listactivemonitors | grep -q "$MAIN"
then
xrandr --output "$MAIN" --off
xrandr --output "$TV" --auto
else
xrandr --output "$TV" --off
#!/bin/bash
# Make sure to enable nvidia-xconfig --cool-bits=4
# nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan-0]/GPUTargetFanSpeed=5"
#[ $( pgrep -c FanCurveScript ) -lt 2 ] || exit 1 # already running
newfanspeed="0"
while true
do
gputemp=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits)