Skip to content

Instantly share code, notes, and snippets.

@yunazuno
yunazuno / get_no_artwork_file.py
Created February 9, 2011 09:22
Output filepath if the mp3 has no album artwork
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Output filepath if the mp3 has no album artwork.
Usage:
./get_no_artwork_file.py file [file..]
Example:
find . -name "*.mp3" -print0 | xargs -0 ./get_no_artwork_file.py
@yunazuno
yunazuno / uridecodebin.py
Created March 2, 2011 04:56
Audio autoplugin example using 'uridecodebin' element
#!/usr/bin/env python
# uridecodebin.py - Audio autoplugin example using 'uridecodebin' element
#
# Based on:
# decodebin.py - Audio autopluging example using 'decodebin' element
# Copyright (C) 2006 Jason Gerard DeRose <jderose@jasonderose.org>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@yunazuno
yunazuno / install_dianaea.sh
Created April 10, 2011 10:04
Install dionaea on Ubuntu 10.04
#!/bin/sh
#
# Install dionaea on Ubuntu 10.04
#
# Based on: http://dionaea.carnivore.it/#compiling
#
# keep privileged state(bad hack...)
LOCKFILE=$$.pid
touch $LOCKFILE
/*
* Usage of libnotify
* $ gcc -g `pkg-config --libs --cflags gtk+-2.0 glib-2.0` -lnotify -o notify notify.c
*/
#include <stdio.h>
#include <unistd.h>
#include <libnotify/notify.h>
int main(int argc, char* argv[])
{
#!/bin/sh
#
# Create user with specified uid and gid.
# Tested on Ubuntu 10.04
#
if [ $# -ne 3 ]; then
echo 'Usage:' $0 'USERNAME UID GID' 1>&2
exit 1
fi
@yunazuno
yunazuno / klink_on_fedora15.sh
Created November 16, 2011 05:43
Install klink on Fedora15
@yunazuno
yunazuno / log_battery_state.sh
Created December 7, 2011 02:28
Log the battery stete to a file
#!/bin/sh
# Log the battery stete to a file
# Sources of battery information
PROC_INFO='/proc/acpi/battery/BAT0/info'
PROC_STATE='/proc/acpi/battery/BAT0/state'
# Get the current state
type=`grep "model number:" $PROC_INFO | awk -e '{print $3}'`
current=`grep "remaining capacity:" $PROC_STATE | awk -e '{print $3}'`
@yunazuno
yunazuno / barusu.rb
Created December 9, 2011 09:19
Post barusu automatically.
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require "julius"
require "twitter"
Twitter.configure do |config|
config.consumer_key = ''
config.consumer_secret = ''
config.oauth_token = ''
#!/usr/bin/python
import dbus
bat_bus = dbus.SystemBus()
bat_object = bat_bus.get_object('org.freedesktop.UPower',
'/org/freedesktop/UPower/devices/battery_BAT0')
bat_interface = dbus.Interface(bat_object,
'org.freedesktop.DBus.Properties')
percentage = bat_interface.Get("org.freedesktop.UPower.Device",
"Percentage"
#!/bin/sh
DEBUG=""
#DEBUG="--dry-run -vv"
MOUNTPOINT="/mnt/qb/common"
BACKUPROOT="${MOUNTPOINT}/backup/${HOSTNAME%.*}"
mount_backuppoint() {
## バックアップ先のマウント