Skip to content

Instantly share code, notes, and snippets.

View GasparVardanyan's full-sized avatar
💭
btw I use Arch ... 😄

Gaspar Vardanyan GasparVardanyan

💭
btw I use Arch ... 😄
View GitHub Profile
@GasparVardanyan
GasparVardanyan / types_in_the_c18_language
Last active May 23, 2020 22:30
Types in the C18 language
basic types # complete object types
{
char
signed integer types
{
standard signed integer types
{
signed char
short
int
@GasparVardanyan
GasparVardanyan / fptr.c
Last active October 11, 2021 14:44
Something useful about function pointers in C.
# include <stdio.h>
# include <stddef.h>
// x: A function taking short and returning char.
char x (short); // Usage: char c = x ('H');
// x (); // A function
// x (short); // taking short
// char x (short); // and returning char.
// y: A pointer to a function taking short and returning char.
interesting dwm patches to look:
https://dwm.suckless.org/patches/cropwindows/
https://dwm.suckless.org/patches/dynamicswallow/
https://dwm.suckless.org/patches/keychain/
https://dwm.suckless.org/patches/reorganizetags/
https://dwm.suckless.org/patches/status2d/
interesting st patches to look:
https://st.suckless.org/patches/background_image/
https://st.suckless.org/patches/sync/
https://st.suckless.org/patches/undercurl/
template <typename T>
auto popcount8R (const T & val) -> int
{
static_assert (std::is_integral <T> :: value && ! std::is_signed <T> :: value);
if (val == 0)
return 0;
const unsigned char m1 = 0b01010101;
const unsigned char m2 = 0b00110011;
#!/bin/sh
OPFILE=$2
OPMIC_NAME=opusmic
OPMIC_FILE=/tmp/opusmic
OPMIC_RAW=/tmp/opusmic.raw
mkdir -p ~/.config/pulse
OPMIC_CONF=~/.config/pulse/client.conf
@GasparVardanyan
GasparVardanyan / gist:2810deb19a602d45f328b3e48609a750
Created May 15, 2023 14:16
hugo embedded base64 thumbnails
{{ $thumb_base64 := readFile (printf "%s%s" "/public" (.Fill "150x115 q100").RelPermalink) | base64Encode }}
<img src="data:image;base64,{{ $thumb_base64 }}" />
# include <stdio.h>
# include <inttypes.h>
uint_least16_t binrev (uint_least16_t n)
{
uint_least16_t r = 0;
while (n)
{
r <<= 1;
r |= n & 1;