Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
import dbus
bus = dbus.SessionBus()
request_iface = 'org.gnome.Mutter.DisplayConfig'
DisplayConfig = bus.get_object(request_iface,
'/org/gnome/Mutter/DisplayConfig')
data = DisplayConfig.GetCurrentState(dbus_interface=request_iface)
#!/bin/bash
busctl --user call org.gnome.Shell \
/org/gnome/Shell \
org.gnome.Shell \
ShowOSD a{sv} 3 \
icon s deadbeef \
label s "$(deadbeef --nowplaying '%a - %t')" \
level d $(deadbeef --nowplaying-tf '0.$num($muldiv(100,$mul(%playback_time_seconds%,1000),$mul(%length_seconds%,1000)),2)')
@saivert
saivert / wp-set-volume.lua
Created October 5, 2021 18:45
wp-set-volume.lua
#!/usr/local/bin/wpexec
local argv = ...
function getvolandquit(mixer, id)
local volume = mixer:call("get-volume", id)
print("Volume is set to "..tonumber(string.format("%.3f", volume.volume)))
ignoredisk --only-use=vda,vdb
zerombr
# System bootloader configuration
bootloader --append="crashkernel=auto" --location=mbr --boot-drive=vda
bootloader --append="crashkernel=auto" --location=mbr --boot-drive=vdb
# Partition clearing information
clearpart --all --drives=vda,vdb --disklabel=gpt
# Disk partitioning information
part biosboot --fstype=​biosboot --size=1 --ondisk=vda
#[no_mangle]
pub unsafe extern "C" fn libsampleplugin_load(functions: *const DB_functions_t ) -> *mut c_void {
// "functions" argument is a pointer to a struct with function pointers for each API function.
// Callable like so:
let confdir: &CStr = CStr::from_ptr( (*functions).get_config_dir.unwrap()() );
println!("From rust: Deadbeef config dir is {}", confdir.to_str().unwrap());
/* automatically generated by rust-bindgen 0.58.1 */
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
storage: Storage,
}
impl<Storage> __BindgenBitfieldUnit<Storage> {
#[inline]
pub const fn new(storage: Storage) -> Self {
struct SomeData {
name: &'static str,
age: i32,
}
static SOMEDATA: SomeData = SomeData {
name: "saivert",
age: 37
};
@saivert
saivert / db.rs
Last active February 13, 2022 13:30
Boilerplate rust plugin for deadbeef
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct DB_functions_t {
pub vmajor: ::std::os::raw::c_int,
pub vminor: ::std::os::raw::c_int,
pub md5: ::std::option::Option<
unsafe extern "C" fn(
sig: *mut u8,
in_: *const ::std::os::raw::c_char,
len: ::std::os::raw::c_int,
# ALSA monitor config file for PipeWire version "0.3.28" #
properties = {
# Create a JACK device. This is not enabled by default because
# it requires that the PipeWire JACK replacement libraries are
# not used by the session manager, in order to be able to
# connect to the real JACK server.
#alsa.jack-device = false
# Reserve devices.