Skip to content

Instantly share code, notes, and snippets.

View aalhitennf's full-sized avatar
🌚

aalhitennf

🌚
View GitHub Profile
@aalhitennf
aalhitennf / gist:4f601c27d94e9355dba8cf999ecc952b
Last active August 19, 2024 15:13
proc_macro main wrapper
#[proc_macro_attribute]
pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
let input = parse_macro_input!(item as ItemFn);
let fn_name = &input.sig.ident; // Function name
if fn_name != "main" {
panic!("[macro name] can be derived only on main function!");
}
@aalhitennf
aalhitennf / signal.rs
Created May 7, 2024 11:29
Floem MaybeSignal
use floem::reactive::RwSignal;
pub enum MaybeSignal<T>
where
T: 'static,
{
Static(T),
Signal(RwSignal<T>),
}
@aalhitennf
aalhitennf / lemmy-ui.css
Last active July 3, 2023 00:58
lemmy-ui
ul .comments {
margin-left: 20px !important;
}
.container-lg {
width: 100% !important;
}
main,
.create-post {
@aalhitennf
aalhitennf / wg-switch.sh
Created February 5, 2023 10:02
Wireguard connection script
#!/bin/sh
CONFDIR="/etc/wireguard/"
readarray -t AVAILABLE_INTERFACES < <(ls $CONFDIR | awk -F '.' '{print $1}')
readarray -t ACTIVE_INTERFACES < <(wg show | grep 'interface: ' | awk -F 'interface: ' '{print $2}')
list_available_interfaces()
{
for i in "${!AVAILABLE_INTERFACES[@]}"
local awful = require('awful')
local beautiful = require('beautiful')
local gears = require('gears')
local json = require('util.json')
local confdir = gears.filesystem.get_configuration_dir()
local icons = require('theme.icons').taglist
-- File
@aalhitennf
aalhitennf / switch_output.sh
Last active August 24, 2021 19:24
pactl loop outputs with ignore filter
#!/bin/bash
CURRENT_SINK=$(pactl info | grep 'Default Sink' | awk -F ':' '{print $2}')
readarray -t SINKS < <(pactl list sinks | grep 'Name: ' | awk -F ':' '{print $2}')
IGNORE_SINKS=()
VALID_SINKS=()