mirror of https://github.com/captn3m0/Scripts.git
Updates composer, youtube-dl and other scripts
This commit is contained in:
parent
569c4a7715
commit
9128bb7161
29
alsa-info.sh
29
alsa-info.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SCRIPT_VERSION=0.4.63
|
SCRIPT_VERSION=0.4.64
|
||||||
CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog"
|
CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog"
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
@ -35,6 +35,8 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION"
|
||||||
PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
|
PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc"
|
||||||
#Define some simple functions
|
#Define some simple functions
|
||||||
|
|
||||||
|
WGET=$(which wget 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null)
|
||||||
|
|
||||||
pbcheck(){
|
pbcheck(){
|
||||||
[[ $UPLOAD = "no" ]] && return
|
[[ $UPLOAD = "no" ]] && return
|
||||||
|
|
||||||
|
@ -46,10 +48,12 @@ pbcheck(){
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
|
test -z "$WGET" -o ! -x "$WGET" && return
|
||||||
|
|
||||||
SHFILE=`mktemp -t alsa-info.XXXXXXXXXX` || exit 1
|
SHFILE=`mktemp -t alsa-info.XXXXXXXXXX` || exit 1
|
||||||
wget -O $SHFILE "http://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1
|
wget -O $SHFILE "http://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1
|
||||||
REMOTE_VERSION=`grep SCRIPT_VERSION $SHFILE |head -n1 |sed 's/.*=//'`
|
REMOTE_VERSION=`grep SCRIPT_VERSION $SHFILE |head -n1 |sed 's/.*=//'`
|
||||||
if [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
|
if [ -s "$SHFILE" -a "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
|
||||||
if [[ -n $DIALOG ]]
|
if [[ -n $DIALOG ]]
|
||||||
then
|
then
|
||||||
OVERWRITE=
|
OVERWRITE=
|
||||||
|
@ -260,6 +264,7 @@ withall() {
|
||||||
withlsmod
|
withlsmod
|
||||||
withsysfs
|
withsysfs
|
||||||
withdmesg
|
withdmesg
|
||||||
|
WITHALL="no"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_alsa_library_version() {
|
get_alsa_library_version() {
|
||||||
|
@ -629,7 +634,6 @@ fi
|
||||||
#If no command line options are specified, then run as though --with-all was specified
|
#If no command line options are specified, then run as though --with-all was specified
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
update
|
update
|
||||||
withall
|
|
||||||
pbcheck
|
pbcheck
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -642,7 +646,6 @@ if [ -n "$1" ]; then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--pastebin)
|
--pastebin)
|
||||||
update
|
update
|
||||||
withall
|
|
||||||
pbcheck
|
pbcheck
|
||||||
;;
|
;;
|
||||||
--update)
|
--update)
|
||||||
|
@ -651,11 +654,9 @@ if [ -n "$1" ]; then
|
||||||
;;
|
;;
|
||||||
--upload)
|
--upload)
|
||||||
UPLOAD="yes"
|
UPLOAD="yes"
|
||||||
withall
|
|
||||||
;;
|
;;
|
||||||
--no-upload)
|
--no-upload)
|
||||||
UPLOAD="no"
|
UPLOAD="no"
|
||||||
withall
|
|
||||||
;;
|
;;
|
||||||
--output)
|
--output)
|
||||||
shift
|
shift
|
||||||
|
@ -666,27 +667,32 @@ if [ -n "$1" ]; then
|
||||||
echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted"
|
echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted"
|
||||||
KEEP_FILES="yes"
|
KEEP_FILES="yes"
|
||||||
echo ""
|
echo ""
|
||||||
withall
|
|
||||||
;;
|
;;
|
||||||
--with-all)
|
--with-all)
|
||||||
withall
|
withall
|
||||||
;;
|
;;
|
||||||
--with-aplay)
|
--with-aplay)
|
||||||
withaplay
|
withaplay
|
||||||
|
WITHALL="no"
|
||||||
;;
|
;;
|
||||||
--with-amixer)
|
--with-amixer)
|
||||||
withamixer
|
withamixer
|
||||||
|
WITHALL="no"
|
||||||
;;
|
;;
|
||||||
--with-alsactl)
|
--with-alsactl)
|
||||||
withalsactl
|
withalsactl
|
||||||
|
WITHALL="no"
|
||||||
;;
|
;;
|
||||||
--with-devices)
|
--with-devices)
|
||||||
withdevices
|
withdevices
|
||||||
|
WITHALL="no"
|
||||||
;;
|
;;
|
||||||
--with-dmesg)
|
--with-dmesg)
|
||||||
withdmesg
|
withdmesg
|
||||||
|
WITHALL="no"
|
||||||
;;
|
;;
|
||||||
--with-configs)
|
--with-configs)
|
||||||
|
WITHALL="no"
|
||||||
if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]]
|
if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]]
|
||||||
then
|
then
|
||||||
echo "!!ALSA configuration files" >> $FILE
|
echo "!!ALSA configuration files" >> $FILE
|
||||||
|
@ -716,7 +722,9 @@ if [ -n "$1" ]; then
|
||||||
;;
|
;;
|
||||||
--stdout)
|
--stdout)
|
||||||
UPLOAD="no"
|
UPLOAD="no"
|
||||||
|
if [ -z "$WITHALL" ]; then
|
||||||
withall
|
withall
|
||||||
|
fi
|
||||||
cat $FILE
|
cat $FILE
|
||||||
rm $FILE
|
rm $FILE
|
||||||
;;
|
;;
|
||||||
|
@ -765,6 +773,10 @@ if [ "$PROCEED" = "no" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$WITHALL" ]; then
|
||||||
|
withall
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$UPLOAD" = "ask" ]; then
|
if [ "$UPLOAD" = "ask" ]; then
|
||||||
if [ -n "$DIALOG" ]; then
|
if [ -n "$DIALOG" ]; then
|
||||||
dialog --backtitle "$BGTITLE" --title "Information collected" --yes-label " UPLOAD / SHARE " --no-label " SAVE LOCALLY " --defaultno --yesno "\n\nAutomatically upload ALSA information to $WWWSERVICE?" 10 80
|
dialog --backtitle "$BGTITLE" --title "Information collected" --yes-label " UPLOAD / SHARE " --no-label " SAVE LOCALLY " --defaultno --yesno "\n\nAutomatically upload ALSA information to $WWWSERVICE?" 10 80
|
||||||
|
@ -823,8 +835,7 @@ if [ "$UPLOAD" = "no" ]; then
|
||||||
fi # UPLOAD
|
fi # UPLOAD
|
||||||
|
|
||||||
#Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it doesnt.
|
#Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it doesnt.
|
||||||
if
|
if [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ `wget --help |grep post-file` ]]
|
||||||
WGET=$(which wget 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null); [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ `wget --help |grep post-file` ]]
|
|
||||||
then
|
then
|
||||||
|
|
||||||
if [[ -n $DIALOG ]]
|
if [[ -n $DIALOG ]]
|
||||||
|
|
147
jade
147
jade
|
@ -1,147 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var fs = require('fs')
|
|
||||||
, program = require('commander')
|
|
||||||
, path = require('path')
|
|
||||||
, basename = path.basename
|
|
||||||
, dirname = path.dirname
|
|
||||||
, resolve = path.resolve
|
|
||||||
, join = path.join
|
|
||||||
, mkdirp = require('mkdirp')
|
|
||||||
, jade = require('../');
|
|
||||||
|
|
||||||
// jade options
|
|
||||||
|
|
||||||
var options = {};
|
|
||||||
|
|
||||||
// options
|
|
||||||
|
|
||||||
program
|
|
||||||
.version(jade.version)
|
|
||||||
.usage('[options] [dir|file ...]')
|
|
||||||
.option('-o, --obj <str>', 'javascript options object')
|
|
||||||
.option('-O, --out <dir>', 'output the compiled html to <dir>')
|
|
||||||
.option('-p, --path <path>', 'filename used to resolve includes')
|
|
||||||
.option('-P, --pretty', 'compile pretty html output')
|
|
||||||
.option('-c, --client', 'compile for client-side runtime.js')
|
|
||||||
.option('-D, --no-debug', 'compile without debugging (smaller functions)')
|
|
||||||
|
|
||||||
program.on('--help', function(){
|
|
||||||
console.log(' Examples:');
|
|
||||||
console.log('');
|
|
||||||
console.log(' # translate jade the templates dir');
|
|
||||||
console.log(' $ jade templates');
|
|
||||||
console.log('');
|
|
||||||
console.log(' # create {foo,bar}.html');
|
|
||||||
console.log(' $ jade {foo,bar}.jade');
|
|
||||||
console.log('');
|
|
||||||
console.log(' # jade over stdio');
|
|
||||||
console.log(' $ jade < my.jade > my.html');
|
|
||||||
console.log('');
|
|
||||||
console.log(' # jade over stdio');
|
|
||||||
console.log(' $ echo "h1 Jade!" | jade');
|
|
||||||
console.log('');
|
|
||||||
console.log(' # foo, bar dirs rendering to /tmp');
|
|
||||||
console.log(' $ jade foo bar --out /tmp ');
|
|
||||||
console.log('');
|
|
||||||
});
|
|
||||||
|
|
||||||
program.parse(process.argv);
|
|
||||||
|
|
||||||
// options given, parse them
|
|
||||||
|
|
||||||
if (program.obj) options = eval('(' + program.obj + ')');
|
|
||||||
|
|
||||||
// --filename
|
|
||||||
|
|
||||||
if (program.path) options.filename = program.path;
|
|
||||||
|
|
||||||
// --no-debug
|
|
||||||
|
|
||||||
options.compileDebug = program.debug;
|
|
||||||
|
|
||||||
// --client
|
|
||||||
|
|
||||||
options.client = program.client;
|
|
||||||
|
|
||||||
// --pretty
|
|
||||||
|
|
||||||
options.pretty = program.pretty;
|
|
||||||
|
|
||||||
// left-over args are file paths
|
|
||||||
|
|
||||||
var files = program.args;
|
|
||||||
|
|
||||||
// compile files
|
|
||||||
|
|
||||||
if (files.length) {
|
|
||||||
console.log();
|
|
||||||
files.forEach(renderFile);
|
|
||||||
process.on('exit', console.log);
|
|
||||||
// stdio
|
|
||||||
} else {
|
|
||||||
stdin();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile from stdin.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function stdin() {
|
|
||||||
var buf = '';
|
|
||||||
process.stdin.setEncoding('utf8');
|
|
||||||
process.stdin.on('data', function(chunk){ buf += chunk; });
|
|
||||||
process.stdin.on('end', function(){
|
|
||||||
var fn = jade.compile(buf, options);
|
|
||||||
var output = options.client
|
|
||||||
? fn.toString()
|
|
||||||
: fn(options);
|
|
||||||
process.stdout.write(output);
|
|
||||||
}).resume();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process the given path, compiling the jade files found.
|
|
||||||
* Always walk the subdirectories.
|
|
||||||
*/
|
|
||||||
|
|
||||||
function renderFile(path) {
|
|
||||||
var re = /\.jade$/;
|
|
||||||
fs.lstat(path, function(err, stat) {
|
|
||||||
if (err) throw err;
|
|
||||||
// Found jade file
|
|
||||||
if (stat.isFile() && re.test(path)) {
|
|
||||||
fs.readFile(path, 'utf8', function(err, str){
|
|
||||||
if (err) throw err;
|
|
||||||
options.filename = path;
|
|
||||||
var fn = jade.compile(str, options);
|
|
||||||
var extname = options.client ? '.js' : '.html';
|
|
||||||
path = path.replace(re, extname);
|
|
||||||
if (program.out) path = join(program.out, basename(path));
|
|
||||||
var dir = resolve(dirname(path));
|
|
||||||
mkdirp(dir, 0755, function(err){
|
|
||||||
if (err) throw err;
|
|
||||||
var output = options.client
|
|
||||||
? fn.toString()
|
|
||||||
: fn(options);
|
|
||||||
fs.writeFile(path, output, function(err){
|
|
||||||
if (err) throw err;
|
|
||||||
console.log(' \033[90mrendered \033[36m%s\033[0m', path);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// Found directory
|
|
||||||
} else if (stat.isDirectory()) {
|
|
||||||
fs.readdir(path, function(err, files) {
|
|
||||||
if (err) throw err;
|
|
||||||
files.map(function(filename) {
|
|
||||||
return path + '/' + filename;
|
|
||||||
}).forEach(renderFile);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
BIN
youtube-dl
BIN
youtube-dl
Binary file not shown.
Loading…
Reference in New Issue