Skip to content

Instantly share code, notes, and snippets.

View h4tr3d's full-sized avatar

Alexander Drozdov h4tr3d

View GitHub Profile
@timo
timo / urxvt_panel.sh
Last active December 26, 2017 02:01
how to put an urxvt at the bottom of the screen to behave just like a panel.
#!/usr/bin/env zsh
killall -SIGSTOP i3
urxvt -geometry 100x2 -name "flub" -e tmux -L CNTR&
sleep 1
ID=0x`xwininfo -root -tree | grep "flub" | sed -e 's/.*0x//' -e 's/ .*//'`
SCRNWDT=`xrandr | grep \* | sed -e 's/x.*//' -e 's/^ *//'`
xprop -id $ID -f _NET_WM_STRUT_PARTIAL 32cccccccccccc -set _NET_WM_STRUT_PARTIAL "0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, $SCRNWDT"
xprop -id $ID -f _NET_WM_WINDOW_TYPE 32a -set _NET_WM_WINDOW_TYPE _NET_WM_WINDOW_TYPE_DOCK
tmux -L CNTR send-keys 'countup-bin $COLUMNS 5' "Enter"
tmux -L CNTR set-option -g status off
@panzi
panzi / portable_endian.h
Last active August 9, 2024 13:12
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, Mac OS X, and QNX. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put …
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
@yohhoy
yohhoy / yuvrgb.md
Last active May 30, 2025 23:21
RGB <=> YCbCr(YPbPr) color space conversion
Y  = a * R + b * G + c * B
Cb = (B - Y) / d
Cr = (R - Y) / e
BT.601 BT.709 BT.2020
a 0.299 0.2126 0.2627
b 0.587 0.7152 0.6780
@bindreams
bindreams / svstream.hpp
Last active June 4, 2025 09:18
string_view compatible std::istringstream.
/**
* MIT No Attribution
*
* Copyright 2020-2024 Anna Zhukova
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so.