Skip to content

Instantly share code, notes, and snippets.

@adam-currie
adam-currie / toggledesktopicons
Last active August 26, 2024 22:33
Hides all desktop icons, or shows them if they're all hidden already.
#!/usr/bin/env bash
# Hides all unhidden tesktop icons, or if they are all hidden already,
# unhides all (excluding dot prefixed).
# (this way allows adding to desktop even if all is hidden)
# NOTE: your DE/file manager has to support .hidden files (different from just supporting hiding files prepended with '.')
# afaik its supported with the major distros/file managers (gnome, plasma, xfce)
DESKTOP_DIR=~/Desktop
HIDDEN_FILE="$DESKTOP_DIR/.hidden"
@adam-currie
adam-currie / lendx
Last active May 26, 2022 19:20
runs a command as another user with current users x server
#!/bin/bash
selfBaseName=$(basename -- "$(readlink -f -- "$0")")
usage="Usage: ${selfBaseName} <username> <command>"
if test $# -ne 2; then
echo $usage
exit
fi
@adam-currie
adam-currie / contains.h
Created December 30, 2021 18:55
checks if a container contains an item eg: strings>>contains("hello")
#pragma once
template<typename T>
class contains {
const T& item;
public:
contains(const T& item) : item(item) {}
template<typename C>
import android.arch.lifecycle.Observer;
import android.support.annotation.Nullable;
public abstract class IgnorantObserver<T> implements Observer<T>{
private boolean isIgnoring = false;
private boolean doingIgnorantly = false;
public IgnorantObserver(){
this(false);
}