Skip to content

Instantly share code, notes, and snippets.

View bgstack15's full-sized avatar

B. Stack bgstack15

View GitHub Profile
@luigifab
luigifab / appearance__focus-visible.gtk3.patch
Last active February 11, 2024 10:11
gtk3-classic (GTK 3.24) [gtk-3.24.40-deb.sh] & gtk4-classic (GTK 4.12) [gtk-4.12.5-deb.sh] / for Debian Testing
# GtkWindow3: restore focus on application start
# https://github.com/GNOME/gtk/blob/3.24.37/gtk/gtkwindow.c
Index: b/gtk/gtkwindow.c
===================================================================
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6357,7 +6357,9 @@ gtk_window_map
/* inherit from transient parent, so that a dialog that is
* opened via keynav shows focus initially
*/
@kbabioch
kbabioch / wireguard
Last active March 12, 2024 14:35
LSBInitScript for Wireguard: This is a leightweight init script for Wireguard. While Wireguard itself requires only minimal overhead to setup and start, it still requires some script invocations (e.g. during boot).
#! /bin/bash
# Copyright (c) 2021 Karol Babioch <karol@babioch.de>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@Lauszus
Lauszus / crc.py
Last active March 9, 2024 02:50
Generic CRC-8, CRC-16 and CRC-32 calculations in Python
#!/usr/bin/env python
# Inspired by: https://www.youtube.com/watch?v=izG7qT0EpBw
# The CRC values are verified using: https://crccalc.com/
def reflect_data(x, width):
# See: https://stackoverflow.com/a/20918545
if width == 8:
x = ((x & 0x55) << 1) | ((x & 0xAA) >> 1)
x = ((x & 0x33) << 2) | ((x & 0xCC) >> 2)
x = ((x & 0x0F) << 4) | ((x & 0xF0) >> 4)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
/**
* Set the WM_CLASS property of a window specified by it's ID
* Usage: set_wm_class <window id> <window class> <application name>
* Compile with: gcc set_wm_class.c -lX11 -o set_wm_class
diff --git a/gtk/gtkfilechooserprivate.h b/gtk/gtkfilechooserprivate.h
index a0a622c111..2af859433d 100644
--- a/gtk/gtkfilechooserprivate.h
+++ b/gtk/gtkfilechooserprivate.h
@@ -32,10 +32,14 @@
#include "gtktreestore.h"
#include "gtktreeview.h"
#include "gtkbox.h"
+#include "gtkiconview.h"
+#include "gtkscale.h"
@cvan
cvan / HOWTO.md
Last active April 15, 2024 04:01
get all URLs of all network requests made on a web page from the Chrome Dev Tools (from an exported HAR)

Setup

Using Homebrew on Mac OS X:

brew install jq

Add these aliases to your profile (e.g., ~/.zshrc, ~/.bashrc, ~/.profile, etc.):

alias hurlp='pbpaste | jq ".log.entries" | tee >(jq --raw-output "[.[] | .request.url] | sort | unique | .[]")'

alias hurld='pbpaste | jq ".log.entries" | jq --raw-output "[.[] | .request.url] | sort | unique | .[]" | harurls | tee >(xargs -n 1 curl -O $1)'

@hazcod
hazcod / apache-plex-reverse-proxy.vhost
Last active December 9, 2023 19:02
Apache2 reverse proxy vhost configuration for Plex. Rerquires modules ssl, proxy, wstunnel
This current configuration is based of at least Server Version 1.16.5.1488 and Web Version: 3.108.2.
This updated config file allows the playing of trailers and TV Show theme music where as the previous one did not.
## Requirements
1. Apache version > 2.4
2. A bunch of mod's enabled (proxy, ssl, proxy_wstunnel, http, dir, env, headers, proxy_balancer, proxy_http, rewrite)
3. Protocols h2 http/1.1 needs apachectl -V 2.4.17 and higher...
## Apache .conf file
@rodnaph
rodnaph / hostname.yml
Created May 14, 2015 11:14
Get local hostname in Ansible
- local_action: command hostname
register: hostname
- debug: msg=hostname.stdout