Fluo de senkonscienco

Indekso
Debian GNU/Linux
Bildoj
Gregueríoj
Skriptoj

Skriptoj

distrostate
doze
my2cents
y
cliching

distrostate
If you're running a mixed Debian system and wonder just how mixed your system is, this script is for you.
Preferably check the more up-to-date Github version.

#!/usr/bin/env bash

set -e

SCRIPTNAME=$(basename "$0")
VERSION="1.0.2"

usage() {
    cat << EOF
NAME
    $SCRIPTNAME - check how mixed (or unmixed) your system is

SYNOPSIS
    $SCRIPTNAME [OPTION]

DESCRIPTION
    The script uses apt-show-versions to gather information about
    package repositories (names, quantity and percent of the packages in system)
    used in the current Debian install.

    -m, --show-missing  Print package names that are not found in any
                        repository. These normally consist of obsolete packages
                        or packages installed outside APT.

    -h, --help          Show usage and exit.
    -V, --version       Show version info and exit.

EOF
}

version() {
    echo "$SCRIPTNAME" "$VERSION"
    exit 0
}

show_obsolete_pkgs() {
    LIST_OBSOLETE=$(grep "installed: No available version\|newer than" "$TMPFILE" | awk '{print $1}')
    if [ "$LIST_OBSOLETE" == "" ]; then
        return
    fi

    echo "Packages not in any repo"
    for i in $LIST_OBSOLETE ; do
        printf "\t"$i"\n"
    done
    echo "----------------------------------------------------------"
}

if [ "$1" ] && [ "$1" == "-h" -o "$1" == "--help" ]; then
    usage
    exit 0
fi

if [ "$1" ] && [ "$1" == "-V" -o "$1" == "--version" ]; then
    version
    exit 0
fi

# Check the "dependencies" first
if [ ! -x /usr/bin/apt-show-versions ]; then
    echo "Install apt-show-versions first."
    exit 1
fi

if [ ! -x /usr/bin/bc ]; then
    echo "Install bc first."
    exit 1
fi

TMPFILE=$(mktemp -p "$HOME" $SCRIPTNAME.XXXXXXXX --suffix=.tmp)
apt-show-versions | fgrep -v " not installed" > "$TMPFILE"

PKGS_TOTAL=$(wc -l "$TMPFILE" | cut -d" " -f1)
PKGS_OBSOLETE=$(grep "installed: No available version\|newer than" "$TMPFILE" | wc -l)

REPO_NAMES=$(awk -F"/" '{ print $2 }' "$TMPFILE" | cut -d" " -f1 | sort -u | sed '/^$/d')

echo "=========================================================="
echo "Package status of $HOSTNAME ($(cat /etc/debian_version))"
echo "----------------------------------------------------------"

for line in $REPO_NAMES
do
    NUM_PKGS=$(grep "/$line" "$TMPFILE" | wc -l)
    PERCENT=$(echo "scale=5; ($NUM_PKGS/$PKGS_TOTAL)*100" | bc -lq | xargs printf "%1.2f")
    printf "%6s %% \t %-10s \t %9d \t packages\n" $PERCENT $line $NUM_PKGS
done

if [ $PKGS_OBSOLETE -ne 0 ]; then
    OBS_PERCENT=$(echo "scale=5; ($PKGS_OBSOLETE/$PKGS_TOTAL)*100" | bc -lq | xargs printf "%1.2f")
    printf "%6s %% \t not in any repo \t %d \t packages\n" $OBS_PERCENT $PKGS_OBSOLETE
fi

echo "----------------------------------------------------------"

if [ "$1" ] && [ "$1" == "-m" -o "$1" == "--show-missing" ]; then
    show_obsolete_pkgs
fi

printf "100.00 %% \t total \t %17d \t packages\n" "$PKGS_TOTAL"
echo "----------------------------------------------------------"

rm "$TMPFILE"

exit 0

doze


#!/bin/bash

# --- Change the values according to your taste ---
AUDIOPATH="$HOME"/audio/
PLAYLISTDIR="$HOME"/audio/playlists
# -------------------------------------------------

AUDIOPLAYER="/usr/bin/mplayer"
PLAYLIST="$PLAYLISTDIR"/$(basename "$0")-all

if [ ! -x $AUDIOPLAYER ]; then
    echo "Install mplayer and try again."
    exit 1
fi

make_playlist () {

    TEMPLIST=$(mktemp -p "$HOME" $(basename "$0").XXXXXXXX --suffix=.tmp)

    if [ -d "$PLAYLISTDIR" ]; then
        touch "$PLAYLIST"
    else
        mkdir -p "$PLAYLISTDIR"
        touch "$PLAYLIST"
    fi

    find $AUDIOPATH -print -type f > "$TEMPLIST"
    grep -i 'mp3$' "$TEMPLIST" > "$PLAYLIST"
    grep -i 'ogg$' "$TEMPLIST" >> "$PLAYLIST"
    grep -i 'm4a$' "$TEMPLIST" >> "$PLAYLIST"
    # Mplayer doesn't support MIDI files but they're audio anyway, kind of.
    # Uncomment if wanted.
    #grep -i 'mid$' "$TEMPLIST" >> "$PLAYLIST"
    grep -i 'wma$' "$TEMPLIST" >> "$PLAYLIST"
    grep -i 'flac$' "$TEMPLIST" >> "$PLAYLIST"
    grep -i 'mp4$' "$TEMPLIST" >> "$PLAYLIST"

    rm "$TEMPLIST"

    echo Total files: $(wc -l "$PLAYLIST")
}

checkplay() {
    if [ ! -f "$PLAYLIST" ]; then
        make_playlist
        $AUDIOPLAYER -shuffle -playlist $PLAYLIST
    else
        $AUDIOPLAYER -shuffle -playlist $PLAYLIST
    fi
}

usage() {
    cat << EOF
Usage: $(basename "$0") [ARG]

  [digit]			Doze for [digit] seconds and start playing
  [digit]m			Doze for [digit] minutes and start playing
  [digit]h			Doze for [digit] hours and start playing
  -c | --create			Create playlist w/o playing it
  -h | --help			Show this help
  -d | --dir [dir]		Play all audio files in [dir]
  -t | --track [path]		Play just one track
  [digit] path-to-track		"Alarm with a certain track." Doze for [digit]
                and play specified track, continuing with
                random play

                w/o ARG playing starts immediately
EOF
}

# Show usage
if [ "$1" == "-h" -o "$1" == "--help" ]; then
    usage
    exit 0
fi

# Just create playlist w/o playing it
if [ "$1" == "-c" -o "$1" == "--create" ]; then
    make_playlist
    exit 0
fi

# Play directory
if [ "$1" == "-d" -o "$1" == "--dir" ]; then
    if [ ! -n "$2" ]; then
        echo "No argument given. Aborting."
        exit 1
    else
        if [[ "$2" != */ ]]; then
            DIR="$2"/
        else
            DIR="$2"
        fi
        $AUDIOPLAYER "$DIR"*
        exit 0
    fi
fi

# Play a track
if [ "$1" == "-t" -o "$1" == "--track" ]; then
    if [ ! -n "$2" ]; then
        echo "No argument given. Aborting."
        exit 1
    else
        $AUDIOPLAYER "$2"
        exit 0
    fi
fi

# Play certain playlist
if [ "$1" == "-p" -o "$1" == "--playlist" ]; then
    if [ ! -n "$2" ]; then
        echo "No argument given. Aborting."
        exit 1
    else
        $AUDIOPLAYER -playlist "$2"
        exit 0
    fi
fi

# Play certain playlist in random order
if [ "$1" == "-ps" -o "$1" == "--playlistshuffle" ]; then
    if [ ! -n "$2" ]; then
        echo "No argument given. Aborting."
        exit 1
    else
        $AUDIOPLAYER -shuffle -playlist "$2"
        exit 0
    fi
fi

# Start playing immediately
if [ "$#" -eq 0 ]; then
    checkplay
    exit 0
fi

# Doze first
if [ "$#" -eq 1 ]; then
    sleep "$1"
    checkplay
    exit 0
fi

# Doze and play "alarm"
if [ "$#" -eq 2 ]; then
    sleep "$1"
    $AUDIOPLAYER "$2"
    checkplay
    exit 0
fi


my2cents
See Just Intonation Explained for more information on just tuning systems.

#!/usr/bin/env python

"""
my2cents 0.1 by debil 2007
--------------------------
This program converts just ratios
to cents. 'N' is the nominator and
'P' is the denominator of given just
ratio.
"""

from __future__ import division
import math

print '--- my2cents 0.1 ---'
print '  (Type 0 to quit)'

cont = True

while cont:

    n = int(input('N: '))
    if n == 0:
        cont = False
        break

    p = int(input('P: '))
    if p == 0:
        cont = False
        break

    answer = math.log10(n/p) * 1200/math.log10(2)

    print str(n)+'/'+str(p)+' is '+str(answer)+' cents.'

y

#!/bin/bash

# Usage:
#
# Name the script how you prefer. This example uses "y" as a script's name.
#
# For example search with DuckDuckGo via your chosen GUI browser:
# $ y ddg death may be your santa claus
#
# Do the same but with text browser of your liking:
# $ y -c ddg death may be your santa claus
#
# Search YouTube:
# $ y yt death may be your santa claus
#
# Or list all Debian related yubnub commands:
# $ y ls debian
#
# Etc. etc.

set -e

# Change as you please
CLIBROWSER='w3m'
GUIBROWSER='iceweasel'

# Change to your liking
#TERMCMD='xterm -bg black -fg white -ls -j -s -sl 10000 +sb \
#-fa LucidaTypewriter -fs 9 -e '
TERMCMD='urxvt -e '

if [ "$1" == "-c" ]; then
    shift
    SRCH_STR="$@"
    #$CLIBROWSER http://yubnub.org/parser/parse?command="$SRCH_STR"
    $CLIBROWSER http://yubnub.ktamas.com/parser/parse?command="$SRCH_STR"
    exit 0
else
    SRCH_STR="$@"
    #$GUIBROWSER http://yubnub.org/parser/parse?command="$SRCH_STR"
    $GUIBROWSER http://yubnub.ktamas.com/parser/parse?command="$SRCH_STR"
    exit 0
fi

cliching
Click to download/see the script.


~
~
~
~
~
~
~