Skip to content

Instantly share code, notes, and snippets.

@UnaNancyOwen
UnaNancyOwen / find_avx.cmake
Last active July 22, 2024 17:58
Check for the presence of AVX and figure out the flags to use for it.
# Check for the presence of AVX and figure out the flags to use for it.
macro(CHECK_FOR_AVX)
set(AVX_FLAGS)
include(CheckCXXSourceRuns)
set(CMAKE_REQUIRED_FLAGS)
# Check AVX
if(MSVC AND NOT MSVC_VERSION LESS 1600)
set(CMAKE_REQUIRED_FLAGS "/arch:AVX")
@KurtJacobson
KurtJacobson / drag.c
Last active March 24, 2023 21:37
Re-positioning Gtk widget with a mouse drag in C and Python
#include <gtk/gtk.h>
// Source:
// http://www.linuxforums.org/forum/programming-scripting/117713-gtk-moving-widget-mouse-post906490.html#post906490
// higher values make movement more performant
// lower values make movement smoother
const gint Sensitivity = 1;
const gint EvMask = GDK_BUTTON_PRESS_MASK | GDK_BUTTON1_MOTION_MASK;
@Tamal
Tamal / set-chroot.sh
Last active July 6, 2024 20:39
Setting up chroot from a live image in Fedora. Regenerate grub2 for Fedora.
$ # Use Live CD to boot
$ sudo su # Switch to root
$ fdisk -l # Get names of root, boot & EFI partition names. you can also use blkid
$ mount /dev/mapper/fedora_localhost--live-root /mnt # mount root partition
$ cat /mnt/etc/fedora-release
Fedora release 31 (Thirty One)
$ mount /dev/nvme0n1p2 /mnt/boot # mount boot partition
$ mount /dev/nvme0n1p1 /mnt/boot/efi # mount EFI partition
# Note: If you are not able to mount EFI partition ('Input/Output error'),
# You may have to repair ESP file system or format ESP.